VB.NET: Char.IsDigit()

Fungsi ini untuk mengecek apakah nilai string hanya berupa digit numerik (0-9).

Contoh:
UI:

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

  If Char.IsDigit(TextBox1.Text.Chars(TextBox1.TextLength - 1)) = False Then
      MsgBox("Digits Only")
  End If

End Sub


Runtime:


Click here if you like this article.


Post a Comment

0 Comments