开发者

MaskedTextBox and hexadecimal

开发者 https://www.devze.com 2023-03-12 00:50 出处:网络
How can I create a MaskedTextBox for accepting hex开发者_JAVA百科adecimals and spaces? I am using Windows Forms in .NET.Simple: you can\'t.

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

精彩评论

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

关注公众号