bonjour

j'ai créé une listbox par code :


Code : Sélectionner tout - Visualiser dans une fenêtre à part
Private ListBoxClient As New ListBox
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Dim Cmd As New SqlCommand("Select NOM_Client From MaTable ....")
Dim DR As SqlDataReader = Cmd.ExecuteReader()
 
            ListBoxClient.Items.Clear()
            If DR.HasRows Then
                ListBoxClient.Visible = True
                ListBoxClient.Size = New System.Drawing.Size(374, 80)
                ListBoxClient.Font = New Font("Arial", 10, FontStyle.Regular)
                ListBoxClient.Location = New System.Drawing.Point(526, 180)
                Me.GrpEnteteF.Controls.Add(ListBoxClient)
                ListBoxClient.BringToFront()
                While DR.Read
                    ListBoxClient.Items.Add(DR.GetValue(0))
                End While
            End If
            ListBoxClient.SelectedIndex = 0
Mais aprés que ListBoxClient reçoit le focus, Comment peut on gréé son event Keypress ou autre event

merci