I have a question about how to validate a text box with only word inside. Below is my code i use, it's only can detect if number 1 to 9 in single number, but not 11 or 999 or Joanne11 Joa223nne etc. I want it can detect the text box have and number or symbol then will show an error messageBox, else continue.
Please help me, I think for it for few days already.
Thank You.
Please help me, I think for it for few days already.
Thank You.
VB.NET:
Public Class Task2
Dim userName As String
Private Sub btnContinue_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnContinue.Click
userName = txtName.Text
If userName Like "[0-9]" Then
MessageBox.Show("Error", "Invalid Input!", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
MessageBox.Show("Hello " & userName & vbNewLine & "You have chosen the " & colorName & " scheme.", "Greeting", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End Sub
End Class