Method 1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text.Trim <> "" Then
If Char.IsLetter(Me.TextBox1.Text) Then
ListBox1.Items.Add(TextBox1.Text)
TextBox1.Text = ""
Else
MsgBox("Please enter characters only", MsgBoxStyle.Exclamation, "Character Alert")
End If
End If
End Sub
Method 2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text.Trim <> "" Then
ListBox1.Items.Add(TextBox1.Text)
TextBox1.Text = ""
End If
End Sub
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
Check_character(e)
End Sub
Sub Check_character(ByVal e As System.Windows.Forms.KeyPressEventArgs)
If Char.IsLetter(e.KeyChar) = False And (Asc(e.KeyChar) <> 13) And (Asc(e.KeyChar) <> 8) And Char.IsWhiteSpace(e.KeyChar) = False Then
e.Handled = True
MsgBox("Only Characters Allowed", MsgBoxStyle.Exclamation, "Character Alert")
End If
End Sub