Bonjour,

J'ai un datagridview ou j'affiche les informations de la commande soit
le numèro et la date + l'employé qui s'occupe de celle-ci.

Je souhaite que dans chaque nouvelle ligne que j'ajoute à mon datagridview
je puisse sélectioner dans une comboBox un employé existant dans ma bdd.

j'essaye depuis un moment de bind mon DataGridViewComboBoxCell à une list mais sans succès

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 
            dgv_Commandes.Rows.Add();
            int indexLigne = dgv_Commandes.Rows.Count - 1;
            dgv_Commandes[3, indexLigne] = new DataGridViewComboBoxCell();
            List<Clients> lstClientsCb = new List<Clients>(new Clients().GetClients("%"));
            (( DataGridViewComboBoxCell)dgv_Commandes[3, indexLigne]).DisplayStyle = DataGridViewComboBoxDisplayStyle.ComboBox;
 
            (( DataGridViewComboBoxCell)dgv_Commandes[3, indexLigne]).DataSource = lstClientsCb;
            (( DataGridViewComboBoxCell)dgv_Commandes[3, indexLigne]).DisplayMember = "prenomClients";
            (( DataGridViewComboBoxCell)dgv_Commandes[3, indexLigne]).ValueMember = "idClients";
Je vous remercie d'avance de votre aide.