开发者

keys for each datatype

Is it possible in Windows Forms to constrain input to is data type.

For instance if i want to insert a Date in a Textbox, i be limited to 开发者_StackOverflow社区use only this chars [0-9,/]

Is there a easy and fast way to do this?

Regards


If you're doing something other than a date, use MaskedTextBox. Do use DateTimePicker for dates though.

Documentation on the MaskedTextBox.Mask property will tell you how to specify the text you want.


Specifically for dates there is a DateTimePicker control in winforms. With which you can specify a format to limit the characters you want to use to type the date.

For example: dateTimePicker.CustomFormat = "dd/MM/yy"; or dateTimePicker.CustomFormat = "dd-MM-yy";

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜