Come faccio ad evitare che l'utenga tenga un tasto sempre premuto?
Come faccio ad evitare che l'utenga tenga un tasto sempre premuto?
Tony
Ciao, una soluzione veloce:
Attenzione, che bisogna prendere in considerazione i tasti ctrl, shift, alt...codice:Dim isKeyPressOk As Boolean = True Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown If Not isKeyPressOk Then e.SuppressKeyPress = True Else isKeyPressOk = False End If End Sub Private Sub TextBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyUp isKeyPressOk = True End Sub
![]()
Jupy
mi dice che e.SuppressKeyPress = True
non esiste SuppressKeyPress
??![]()
Tony
vb.net 2003 ovviamentecodice:Dim isKeyPressOk As Boolean = True Dim obj_ClassiPersonali As New classiPersonali.ControlloData.TextBoxData(Me.txt_data, Me.lbl_data, Me.tlt_data, Me.pnl_data) Private Sub txt_data_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt_data.TextChanged obj_ClassiPersonali.m_textChange(e, Me.txt_data) End Sub Private Sub txt_data_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txt_data.KeyUp obj_ClassiPersonali.m_keyUp(e, Me.txt_data) isKeyPressOk = True End Sub Private Sub txt_data_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txt_data.KeyDown obj_ClassiPersonali.m_keyDown(e, Me.txt_data) If Not isKeyPressOk Then e.SuppressKeyPress = True ' mi dà errore qui! Else isKeyPressOk = False End If End Sub
dice che non è un membro di system.windows.forms.keyeventsargs
Tony
Ah, ok, allora col 2003 prova ad impostare Handled a True.Originariamente inviato da tony83
vb.net 2003 ovviamente
dice che non è un membro di system.windows.forms.keyeventsargs
MARCO BREVEGLIERI
Software and Web Developer, Teacher and Consultant
Home | Blog | Delphi Podcast | Twitch | Altro...
handled? che proprietà è?Originariamente inviato da alka
Ah, ok, allora col 2003 prova ad impostare Handled a True.
Non l'Ho trovata..![]()
Tony
E' una proprietà dell'oggetto KeyEventArgs che ti viene passato come parametro.Originariamente inviato da tony83
handled? che proprietà è?
Non l'Ho trovata..![]()
MARCO BREVEGLIERI
Software and Web Developer, Teacher and Consultant
Home | Blog | Delphi Podcast | Twitch | Altro...