Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
Dim KeyAscii As Short = Asc(e.KeyChar)
' Check if the typed character is a letter.
If Char.IsDigit(e.KeyChar) = False And _
Char.IsControl(e.KeyChar) = False Then
e.Handled = True
End If
' Check if the typed character is a period.
If KeyAscii = 46 Then
e.Handled = False
End If
End Sub
|