Textbox validation |
| Thiru Kumaran replied to divya rocks at 12-May-08 01:45 |
try this C#.net code for validate the textbox. Use this public function and u can call anywhere to validate textbox.
public void nameval(KeyPressEventArgs e) { if (((e.KeyChar >= 33) && (e.KeyChar < 38)) || ((e.KeyChar > 39) && (e.KeyChar <= 47)) || ((e.KeyChar >= 48) && (e.KeyChar <= 57)) || ((e.KeyChar >= 58) && (e.KeyChar <= 64)) || ((e.KeyChar >= 91) && (e.KeyChar <= 96)) || ((e.KeyChar >= 123) && (e.KeyChar <= 126))) { e.Handled = true; MessageBox.Show("Enter Alphabets","Alert", MessageBoxButtons.OK, MessageBoxIcon.Question); } }
|
|