Carlos Neves
Newcomer
somebody can help me ?
I have build a Classe that inherits one textbox, i make some new property and some overrides of some events of the textbox like this :
Protected Overrides Sub OnKeyPress(ByVal e As System.Windows.Forms.KeyPressEventArgs)
e.Handled = True
Select Case TipoTxt
Case eTipoTxt.AlfaNumerico
e.Handled = Not (IsNumeric(e.KeyChar) Or (e.KeyChar Like "[A-Z]" Or e.KeyChar Like "[a-z]"))
Case eTipoTxt.Moeda
e.Handled = Not (IsNumeric(e.KeyChar) Or (e.KeyChar = "." And Not CBool(InStr(Text, "."))))
Case eTipoTxt.Numerico
e.Handled = Not IsNumeric(e.KeyChar)
Case Else : e.Handled = False
End Select
If e.KeyChar = ChrW(Keys.Back) Then e.Handled = False
MyBase.OnKeyPress(e)
End Sub
why in this event when i put "." or backspace in run time i have to wait 5 seconds of the first time but of the second time in ahead it runs normally.
Thanks
I have build a Classe that inherits one textbox, i make some new property and some overrides of some events of the textbox like this :
Protected Overrides Sub OnKeyPress(ByVal e As System.Windows.Forms.KeyPressEventArgs)
e.Handled = True
Select Case TipoTxt
Case eTipoTxt.AlfaNumerico
e.Handled = Not (IsNumeric(e.KeyChar) Or (e.KeyChar Like "[A-Z]" Or e.KeyChar Like "[a-z]"))
Case eTipoTxt.Moeda
e.Handled = Not (IsNumeric(e.KeyChar) Or (e.KeyChar = "." And Not CBool(InStr(Text, "."))))
Case eTipoTxt.Numerico
e.Handled = Not IsNumeric(e.KeyChar)
Case Else : e.Handled = False
End Select
If e.KeyChar = ChrW(Keys.Back) Then e.Handled = False
MyBase.OnKeyPress(e)
End Sub
why in this event when i put "." or backspace in run time i have to wait 5 seconds of the first time but of the second time in ahead it runs normally.
Thanks