VB.NET: Char.IsLetter()

Fungsi ini untuk mengecek apakah nilai string hanya huruf (A-z).

Contoh:
UI:


Code:
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles TextBox1.TextChanged

  If Char.IsLetter(TextBox1.Text.Chars(TextBox1.TextLength - 1)) = False Then
      MsgBox("Hanya Huruf")
  End If

End Sub


Runtime:

 

Click here if you like this article.


Post a Comment

0 Comments