开发者

MaskedTextBox and hexadecimal

How can I create a MaskedTextBox for accepting hex开发者_JAVA百科adecimals and spaces?

I am using Windows Forms in .NET.


Simple: you can't.

Not with the standard MaskedTextBox.


I solve my problem using KeyDown event. The KeyEventArgs.SuppressKeyPress will handle exactly what I want!


You could try to match the input against a regular expression in the Textbox.Validating event handler.

I've also used a homegrown "RegexMaskedTextBox" solution which I've posted in Stack Overflow question Restricting the characters in the text box.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜