Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MaskedEditTextbox - Handling Space Character

Status
Not open for further replies.

antonio622

Programmer
Jun 10, 2007
20
US
I have a masked edit textbox in my program with the mask value set to ####

I can however enter a value like 5 55 which can cause alot of problems throughout the program.

It seems that the space character, left & right arrow keys (which produce spaces) are the only character other then numbers that can be accidently added to the field.

How can I handle this type of problem to not allow the user to enter the space in the field using spacebar or left & right arrow keys?
 
You could use the KeyDown or KeyUp event to filter out spaces,

MyTextBox.Text.Replace(" ","")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top