Dim Str As String = ""
Private Sub txtRecond_KeyUp(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles txtRecond.KeyUp
txtRecond.Text = Regex.Replace(txtRecond.Text, "[^0-9]", "")
If txtRecond.Text = "" Then
Return
End If
Try
Dim num As Integer = Integer.Parse(txtRecond.Text)
txtRecond.Text = num.ToString()
If (num > ) Or (num = ) Then
txtRecond.Text = ""
End If
Catch ex As Exception
txtRecond.Text = ""
End Try End Sub Private Sub txtRecond_KeyPress(sender As System.Object, e As System.Windows.Forms.KeyPressEventArgs) Handles txtRecond.KeyPress
If Char.IsDigit(e.KeyChar) Or e.KeyChar = Chr() Or e.KeyChar = "." Then
If e.KeyChar = "." And InStr(txtRecond.Text, ".") > Then
e.Handled = True
Else
e.Handled = False
End If
Else
e.Handled = True
End If End Sub