I want to validate the textbox like , the textbox can not accept string value..i can accept only the number value..............................
At first i had validated the textbox in VB.Net like :
=========================================================================================Private Sub txt1_KeyPress(KeyAscii As Integer)
If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 8 Then
KeyAscii = 0
End If
If KeyAscii = 8 Then
KeyAscii = 8
End If
End Sub
=========================================================================================
But i have no idea , how to validate textbox in C#.Net.I have tried but does not works..
=========================================================================================
private void txt1_KeyPress(object sender, KeyPressEventArgs e)
{
int a = e.KeyChar;
if((a<48 || a>57) && a!=8)
{
// ???????????????????????
}
}