Esempio n. 1
0
        private void Form_gestionReservation_achat_Load(object sender, EventArgs e)
        {
            #region Loading comboBox choix Adhérent
            //On désactive l'évenement pour ne pas que la méthode SelectedIndexChanged se lance lors du binding au dataSource
            this.cb_gestionReservation_achat_adherent.SelectedIndexChanged -= new EventHandler(cb_gestionReservation_achat_adherent_SelectedIndexChanged);

            cb_gestionReservation_achat_adherent.DataSource    = GestionClub.getTousLesAdherents();
            cb_gestionReservation_achat_adherent.DisplayMember = "EtatCivil";
            cb_gestionReservation_achat_adherent.ValueMember   = "Numero";

            //On désélectionne les valeurs (ici le DataSource séléctionne par défaut la première valeur de la liste)
            cb_gestionReservation_achat_adherent.SelectedIndex = -1;

            //On réactive l'évènement pour pouvoir accéder à la méthode SelectedIndexChanged lors des conditions requises
            this.cb_gestionReservation_achat_adherent.SelectedIndexChanged += new EventHandler(cb_gestionReservation_achat_adherent_SelectedIndexChanged);
            #endregion

            #region Loading comboBox nbPlaces
            int i = 0;
            foreach (int nbPlaces in GestionClub.getParamNbPlacesAchetables())
            {
                cb_gestionReservation_achat_nbPlaces.Items.Add(GestionClub.getParamNbPlacesAchetables()[i]);
                i++;
            }
            #endregion
        }