public void Familles_Box_Initialiser() { this.ComboBox_Famille.Items.Clear(); if (string.Compare(this.ComboBox_SousFamille.Text, "") == 0) { FamillesDAO Famille_DAO = new FamillesDAO(); List <Familles> FamillesListe = Famille_DAO.GetAll(); int CountF = 0; for (CountF = 0; CountF < FamillesListe.Count; CountF++) { this.ComboBox_Famille.Items.Add(FamillesListe[CountF].Ref_Famille_Operation); } } else { string Ref_S = this.ComboBox_SousFamille.Text; int Ref_SI = int.Parse(Ref_S); SousFamillesDAO Sous_Familles_DAO = new SousFamillesDAO(); List <SousFamilles> SousfamillesListe = Sous_Familles_DAO.GetSousFamilles(Ref_SI); if (SousfamillesListe != null && SousfamillesListe.Count > 0) { this.ComboBox_Famille.Items.Add(SousfamillesListe[0].Ref_Famille_Operation.ToString()); this.ComboBox_Famille.Text = SousfamillesListe[0].Ref_Famille_Operation.ToString(); } else { MessageBox.Show("Pas de cette SousFamille"); } } }
private void ComboBox_SousFamille_TextChanged(object sender, EventArgs e) { this.ComboBox_Famille.Items.Clear(); string Ref_S = this.ComboBox_SousFamille.Text; int Ref_SI = int.Parse(Ref_S); SousFamillesDAO Sous_Familles_DAO = new SousFamillesDAO(); List <SousFamilles> SousfamillesListe = Sous_Familles_DAO.GetSousFamilles(Ref_SI); if (SousfamillesListe != null && SousfamillesListe.Count > 0) { this.ComboBox_Famille.Items.Add(SousfamillesListe[0].Ref_Famille_Operation.ToString()); this.ComboBox_Famille.Text = SousfamillesListe[0].Ref_Famille_Operation.ToString(); } else { MessageBox.Show("Pas de cette SousFamille"); } }