Private Sub cboLocalite01_SelectionChangeCommitted(sender As Object, e As EventArgs) Handles cboLocalite01.SelectionChangeCommitted Console.WriteLine("Combo Text = " & cboLocalite01.Text) My.Computer.Keyboard.SendKeys("{TAB}") End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questione.Handled = true
SelectionChangeCommitted
KeyDown
KeyPress
Private Sub cboLocalite01_KeyDown(sender As Object, e As KeyEventArgs) Handles cboLocalite01.KeyDown If e.KeyCode = Keys.Return Then e.KeyCode = Keys.Tab 'ou e.KeyCode = 0 etc... End Sub
Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load cboLocalite01.Items.Clear() For ll As Integer = 1 To 150 cboLocalite01.Items.Add(ll) Next ll cboLocalite01.DropDownStyle = ComboBoxStyle.Simple cboLocalite01.AutoCompleteMode = AutoCompleteMode.SuggestAppend cboLocalite01.AutoCompleteSource = AutoCompleteSource.ListItems End Sub Private Sub cboLocalite01_KeyPress(sender As Object, e As KeyPressEventArgs) Handles cboLocalite01.KeyPress Console.WriteLine("keypress =>" & e.KeyChar) Me.TextBox1.Text = cboLocalite01.Text & e.KeyChar End Sub Private Sub cboLocalite01_SelectionChangeCommitted(sender As Object, e As EventArgs) Handles cboLocalite01.SelectionChangeCommitted Console.WriteLine("SelectionChangeCommitted") If cboLocalite01.Text <> "" Then cboLocalite01.Text = Me.TextBox1.Text End If End Sub Private Sub cboLocalite01_KeyDown(sender As Object, e As KeyEventArgs) Handles cboLocalite01.KeyDown Console.WriteLine("KeyDown") If e.KeyCode = Keys.Return Then Console.WriteLine("Enter") cboLocalite01.Text = Me.TextBox1.Text End If End Sub Private Sub cboLocalite01_SelectedValueChanged(sender As Object, e As EventArgs) Handles cboLocalite01.SelectedValueChanged Console.WriteLine("SelectedValueChanged") End Sub Private Sub cboLocalite01_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboLocalite01.SelectedIndexChanged Console.WriteLine("SelectedIndexChanged") End Sub End Class
ton code ne fonctionne pas à 100% (ex à l'emploi du backspace...).Comme je te l'ai indiqué dans mon précédent message :"Je te laisse corriger/améliorer si besoin. "
J'y ai regardé pour finaliser... Je ne trouve pas.Ben il va te falloir chercher.... et/ou changer de composant.
Par contre, quand j'appuie sur <ENTER>, là, la combobox se vide.Je pense que la réponse t'a été donnée... et donc que le sujet peut être mis en résolu.