Where is mask property for Textbox?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I like to assign a particualar value with not more 4 decimal points with the
textbox. How to assign it?

Please suggest!

Thanking you in advance,

David S.Noah
 
If you are using 2.0 you can use the Masked edit control for this. In 1.1 /
1.0 you would normally need to implement the code to check for this in the
KeyPress / KeyDown events and cancel any key strokes that are not allowed.

Something like:

if txtBox.text.indexof(".") > 0 then
if txtBox.text.substring(txtBox.text.indexof("."),
txtBox.text.length).length > 4 then
cancel the event
else
let the textbox add the value
end
end
 
David,

..NET 1.x WinForms doesn't have such a control. It has been added for .NET
2.0 version of the library, see MaskedTextBox class.

In .NET1.x VB (C# also I believe) programmers can use old active ActiveX
MaskEdBox from the MSMASK32.OCX.

There are some managed solutions out there you just need to google for them.
For example I found this one:
http://www.c-sharpcorner.com/Code/2003/March/MaskEditControl.asp
 
Back
Top