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.
精彩评论