How to Make text box to aceept numeric values only?
-
Hi, Iam new to c# Can, how to make a normal textbox to accept only numeric values and also some specific format.(not using masked textbox). Thank you, regards Praveen
-
Hi, Iam new to c# Can, how to make a normal textbox to accept only numeric values and also some specific format.(not using masked textbox). Thank you, regards Praveen
Use client-side code to validate the data entered..a javascript function will work fine... Refer to: http://www.shiningstar.net/articles/articles/javascript/checkNumeric.asp?ID=AW
-
Use client-side code to validate the data entered..a javascript function will work fine... Refer to: http://www.shiningstar.net/articles/articles/javascript/checkNumeric.asp?ID=AW
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll -::maximus::-
-
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll -::maximus::-
ooopppss!! sorry please disregard this message. -::maximus::-
-
Hi, Iam new to c# Can, how to make a normal textbox to accept only numeric values and also some specific format.(not using masked textbox). Thank you, regards Praveen
Hello Praveen, You can create your inherted TextBox and use this code: protected override void OnKeyPress(KeyPressEventArgs e) { string _allowedkeychars = "1234567890"; if (_allowedkeychars.IndexOf(e.KeyChar) < 0) { e.Handled = true; return; } // Youre code..... base.OnKeyPress (e); } All the best, Martin