Dim chk As Boolean
Function IsChekcInputValue(ByVal number As Double) As Boolean
If number = 0 Or number = 1 Or number = 2 Or number = 3 Or number = 4 Then
Return True
Else
Return False
End If
End Function
Function IsChekcInputValue(ByVal number As Double) As Boolean
If number = 0 Or number = 1 Or number = 2 Or number = 3 Or number = 4 Then
Return True
Else
Return False
End If
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
For I As Integer = 0 To Trim(TextBox1.Text.Length)
chk = IsChekcInputValue(TextBox1.Text.IndexOf(I))
Next
If chk = False Then
MsgBox("Please Enter 0 To 4 Numbers in Input Box")
Else
MsgBox("Thank U")
End If
End Sub
For I As Integer = 0 To Trim(TextBox1.Text.Length)
chk = IsChekcInputValue(TextBox1.Text.IndexOf(I))
Next
If chk = False Then
MsgBox("Please Enter 0 To 4 Numbers in Input Box")
Else
MsgBox("Thank U")
End If
End Sub
Private Sub TextBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If Char.IsNumber(e.KeyChar) = False Then
e.Handled = True
End If
End Sub
If Char.IsNumber(e.KeyChar) = False Then
e.Handled = True
End If
End Sub