如何阻止用户输入在文本框中粘贴非日期值 [英] How can preventing user to enter of paste a non date value in textbox
本文介绍了如何阻止用户输入在文本框中粘贴非日期值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的所有
我的团队负责人问我是否有可能创建一个仅使用dd / MM / yyyy格式的日期值的用户控件,并阻止任何其他值或要在此文本框中输入的格式(通过键盘或粘贴);通过使用VB.NET。
你能帮我吗
解决方案
是 - 不要使用文本框。
看看这个: http:// www。 asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/Calendar/Calendar.aspx [ ^ ]
使用蒙面控件。
MaskedTextBox类 [ ^ ](赢取应用)
MaskedEdit Demonstration [ ^ ](网络应用程序)
编辑
使用Javascript禁用上下文菜单&按键
禁用右键单击上下文菜单剪切,复制,粘贴 [ ^ ]
如何防止在文本框控件中拖放文本和复制粘贴文本 [ ^ ]
在asp.net文本框中使用javascript禁用复制粘贴右键 [ ^ ]
谷歌更多...
EDIT2
我同意我为你提供网络应用程序的答案,但谷歌怎么样?
如何在C#文本框中禁用右键单击 [ ^ ]
C#取消按键事件 [ ^ ]
如何只允许Windows窗体应用程序中文本框中的字母? [ ^
Dear all
My team leader asked me if there is a possible way to create a user control that takes date values only with the format "dd/MM/yyyy" and prevent any other value or format to be entered (either by keyboard or paste) in this text box; by using VB.NET.
Can you help me please
解决方案
Yes - don't use a text box.
Have a look at this: http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/Calendar/Calendar.aspx[^]
Use Masked control.
MaskedTextBox Class[^](Win app)
MaskedEdit Demonstration[^](Web app)
EDIT
Use Javascript to disable the context menu & keypress
Disable right click context menu cut, copy, paste[^]
How to prevent a drag and drop text and Copy paste text in your textbox control[^]
Disable copy paste right click using javascript in asp.net textbox[^]
Google for more...
EDIT2
I agree that I gave you answers for web app but what about Google?
How To Disable Right Click In C# Textbox[^]
C# Cancel Key press event[^]
How to permit only letters in a textbox in a Windows Forms application?[^]
这篇关于如何阻止用户输入在文本框中粘贴非日期值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文