Expand|Select|Wrap|Line Numbers
- Private Sub TextBox6_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox6.KeyPress
- Dim tb As TextBox = CType(sender, TextBox)
- Dim chr As Char = e.KeyChar
- Dim iLoc As Integer = 0
- If IsNumeric(e.KeyChar) And Not e.KeyChar = "-" Then
- e.Handled = Not IsNumeric(tb.Text & e.KeyChar)
- ElseIf e.KeyChar = "." Then
- If Not (tb.SelectedText = "." Or IsNumeric(tb.Text & e.KeyChar)) Then
- e.Handled = True
- End If
- ElseIf Not Char.IsControl(e.KeyChar) Then
- e.Handled = True
- End If
- iLoc = TextBox6.Text.IndexOf(".")
- If iLoc > 0 Then
- If (TextBox6.Text.Substring(iLoc).Length > 2) And Char.IsControl(e.KeyChar) = False Then
- e.Handled = True
- End If
- End If
- End Sub