tenho esse código em VB.NET e que funciona, mas como sou iniciante no C#.NET eu não estou sabendo como fazer, alguém pode me ajudar?
Protected Overrides Sub onkeypress(ByVal e As System.Windows.Forms.KeyPressEventArgs)
If Not Char.IsNumber(e.KeyChar) And Not e.KeyChar = vbBack And Not e.KeyChar = "." And Not e.KeyChar = "," Or e.KeyChar = Chr(13) Then
e.Handled = True
Else
MyBase.onkeypress(e)
End If
End Sub
Pergunta
Sames Davis
Olá pessoal,
tenho esse código em VB.NET e que funciona, mas como sou iniciante no C#.NET eu não estou sabendo como fazer, alguém pode me ajudar?
Protected Overrides Sub onkeypress(ByVal e As System.Windows.Forms.KeyPressEventArgs) If Not Char.IsNumber(e.KeyChar) And Not e.KeyChar = vbBack And Not e.KeyChar = "." And Not e.KeyChar = "," Or e.KeyChar = Chr(13) Then e.Handled = True Else MyBase.onkeypress(e) End If End SubEu até comecei a fazer, mas não deu certo
protected override void onkeypress(KeyPressEventArgs e) { if ((e.KeyChar.CompareTo((char)Keys.Return)) == 0 && e.KeyChar.Equals(Keys.Back) && e.KeyChar.Equals(Keys.) || !Char.IsNumber(e.KeyChar)) { e.Handled = true; } }Link para o comentário
Compartilhar em outros sites
0 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.