Textbox Input Catching

V

vb6dev2003

Hi,

I would like to prevent a user from entering data in a textbox (BUT not
read-only) by catching the OnBeforeChange in managed code. Can we catch the
ascii input and reset some or all of the characters typed to nothing?

Thanks.

vbdev2003
 
M

Michelle

In the OnBeforeChange event of the textbox, try something like:
if (e.NewValue.ToString() != "")
{
string strNewVal = e.NewValue.ToString();
//perform string manipulation on the value here
//and then set the nodevalue
e.Source.text = strNewVal;
}

Michelle
 
Top