Bonjour,
j' ai un combobox que je remplis à partir d'une bd sqlserver et dont je récupère la valeur sélectionnée lors d'un insert.
jusque là tout se passe bien à merveille mais je voudrai que quand l'insertion se fait en succès le combobox passe automatiquement à l'élément suivant qui s'y trouve.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 Try
                        'insertion dans le table compteur
                        com = New SqlCommand("insert into COMPTEURS(N_ORD_ECO,SOUS_QUART,CIL,QUART,NOM_CLT,AV_ACC,PORTE,RUE,N_CPT_DEPO,N_SERIE,DER_IND_LU,TP_CAL,MAR_DEPO,N_CPT_POS,IND_DEPO,DATE_DEPO,CAL_POS,MAR_POS,AG) values('" & ComboBox1.SelectedItem.ToString & "','" & Replace(TextBox1.Text, "'", " ", 1, vbTextCompare) & "','" & Val(TextBox2.Text) & "','" & Replace(TextBox3.Text, "'", " ", 1, vbTextCompare) & "','" & Replace(TextBox4.Text, "'", " ", 1, vbTextCompare) & "','" & Replace(TextBox5.Text, "'", " ", 1, vbTextCompare) & "','" & Val(TextBox6.Text) & "','" & Replace(TextBox7.Text, "'", " ", 1, vbTextCompare) & "','" & Val(TextBox8.Text) & "','" & Val(TextBox9.Text) & "','" & Val(TextBox10.Text) & "','" & Val(TextBox11.Text) & "','" & TextBox12.Text & "','" & Val(TextBox13.Text) & "','" & Val(TextBox14.Text) & "','" & d & "','" & Val(TextBox16.Text) & "','" & TextBox17.Text & "','" & ComboBox3.SelectedItem & "');", con)
                        com.ExecuteNonQuery()
                        MsgBox("Compteur ajouté avec succés", MsgBoxStyle.OkOnly)
                        TextBox13.Text = ""
                        TextBox14.Text = ""
                        MaskedTextBox1.Text = ""
 
                    Catch ex As Exception
                        MsgBox("Erreur d'insertion des données:" & ex.ToString)
                    End Try
                End If