VB6 Keyacsii code statement into vb.net????

  • Thread starter Thread starter Gary
  • Start date Start date
G

Gary

Hi all, does anyone know what the how to get this vb6 code to work under
vb.net?
I only want to allow digits, backspace and a period to be entered into a
text box.



Private Sub Text13_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 48 To 57 ' Allow digits
Case 8 ' Allow backspace
Case 46 ' Allow period
Case Else
KeyAscii = 0
Beep
End Select
End Sub




Thanks,

Gary
 
In the KeyPress event of the TextBox, have:

If Not (Char.IsNumber(e.KeyChar) OrElse AscW(e.KeyChar) = 8 OrElse
AscW(e.KeyChar) = 46) Then
e.Handled = True
Else
Beep()
End If

Hi all, does anyone know what the how to get this vb6 code to work under
vb.net?
I only want to allow digits, backspace and a period to be entered into a
text box.



Private Sub Text13_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 48 To 57 ' Allow digits
Case 8 ' Allow backspace
Case 46 ' Allow period
Case Else
KeyAscii = 0
Beep
End Select
End Sub




Thanks,

Gary
 
Back
Top