Private Sub FrmMain_Load(...) ... 'Active clavier + Evenement touches push Me.KeyPreview = True AddHandler Me.KeyPress, AddressOf KeyOK End Sub
Private Sub frmMain_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown Me.RectangleShape2.Focus() End Sub
' Interdit le RichTextBox d'avoir le focus Private Sub RTB1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles RTB1.Enter RectangleShape2.Focus() End Sub Private Sub RTB1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles RTB1.LostFocus RectangleShape2.Focus() End Sub
' Gestion des touches Private Sub KeyOK(...) ... RectangleShape1.Focus() End Sub
' Gestion des clicks Private Sub Button_Click(...) ... RectangleShape1.Focus() End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AddHandler TextBox1.KeyPress, AddressOf KeyOK End Sub Private Sub KeyOK(ByVal sender As System.Object, ByVal e As System.EventArgs) Dim MyPush As System.Windows.Forms.KeyPressEventArgs = e Dim MyASC As Integer = AscW(MyPush.KeyChar) Select Case MyASC Case 8 'BACKSPACE Me.Text = "BACKSPACE PRESSED" Case 13 'RETURN Me.Text = "RETURN PRESSED" Case Else Me.Text = "ASC(" & e.ToString & ") PRESSED" End Select End Sub
Case 13
Mets un point d'arret à la ligne
Case 13
Private Sub Button_Click(ByVal eventSender As Object, ByVal eventArgs As System.EventArgs) Handles Button.Click Dim index As Short = Button.GetIndex(CType(eventSender, Windows.Forms.Button))
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionSi je tape 5+5 puis Enter ca ne marche pas
' Interdit le RichTextBox d'avoir le focus Private Sub RTB1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles RTB1.Enter RectangleShape2.Focus() End Sub
j'ai un truc bizarre j'ai changé rectangle2shape.focus() par Me.focus() cela ne marchait pas j'ai remis rectangleshape.focus() puis le code a fonctionné 1 fois puis plus du tout