Click here to Skip to main content
15,078,243 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to add space in text when I leave text box.
for eg. if i enter vehicle number like MH15DK6534. after leave text box is should return the same vehicle number including spaces in vehicle number such as MH 15 DK 6534.
please help me... if you have any idea.. about useful coding.
VR Karthikeyan 6-Jan-16 23:41pm
Are you using Windows forms or WPF?

1 solution

Hi, Use MaskedTextBox in Windows Forms, and set Mask property like LL-00-LL-0000, And replace - with space and you get your required string. Refer the links below to know more about MaskedTextBox.
1. Using Masked TextBox in .NET[^]
2. Using Regular Expressions with the MaskedTextBox Control in Visual Basic[^]
4. C# Corner : Error Display[^]
Vikas Hire 7-Jan-16 2:48am
thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900