There are a few ways of doing this, here's one:
Imports System.Text.RegularExpressions
Public Class Form1
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
Dim num As Integer
Dim valid As Boolean
Try
num = System.Convert.ToDecimal(TextBox1.Text)
valid = True
Catch ex As Exception
valid = False
End Try
Button1.Enabled = valid
End Sub
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
Dim valid As Boolean
Dim reg As New Regex("[0-9]")
Dim match As Match = reg.Match(TextBox2.Text)
valid = Not match.Success
Button1.Enabled = valid
End Sub
End Class
HTH
Enter your message below
Sign in or Join us (it's free).