Check if a string entered is a Digit - VB.NET

This code will check only numbers from 0 - 9)

Tags: VB.NET, VB 2008, VB 2010, VB 2012, VB 2013

The following code checks text entered in textbox:

Check if a string entered is a Digit ( number from 0 - 9)- VB.NET

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)) = True Then

        Else

            MsgBox("Digits Only")

        End If

End Sub

visual basic .net check if a string entered is a digit


Share This

Home | About | Contact | Privacy Policy

Copyright visual-basic-tutorials.com 2017 - All Rights Reserved.