It try to insert 10 digits number to database sql server through textbox it give me this error.
Here is the code which i use for validation the textbox
Code:Private Sub contacttxt_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles contacttxt.KeyPress If (e.KeyChar < Chr(48) Or e.KeyChar > Chr(57)) And e.KeyChar <> Chr(8) Then MessageBox.Show("cannot enter char selection only ") e.Handled = True Else If contacttxt.Text.Length >= 10 Then If e.KeyChar <> ControlChars.Back Then MsgBox("Only 10 Digit") e.Handled = True End If End If End If End Sub




Reply With Quote