Beispiel #1
0
 private void FormHotels_Activated(object sender, EventArgs e)
 {
     if (origenFormHotel)
     {
         comboBoxCiutat.DataSource     = SentenciaSQL.obtenirTaula("ciudades");
         dataGridViewHotels.DataSource = SentenciaSQL.obtenirHotelsDeCiutat((int)comboBoxCiutat.SelectedValue);
         origenFormHotel = false;
     }
 }
Beispiel #2
0
        private void FormHotels_Load(object sender, EventArgs e)
        {
            // Selecciona la columna de la taula de la BD que es mostrarà
            comboBoxCiutat.DisplayMember = "nombre";
            // Selecciona la columna de la taula de la BD que es guardarà
            comboBoxCiutat.ValueMember = "id_ciudad";

            // Relaciona el control amb les dades obtingudes
            comboBoxCiutat.DataSource = SentenciaSQL.obtenirTaula("ciudades");

            // Omple el GridView amb els hotels corresponents a la ciutat seleccionada
            dataGridViewHotels.DataSource = SentenciaSQL.obtenirHotelsDeCiutat((int)comboBoxCiutat.SelectedValue);
        }
Beispiel #3
0
 private void comboBoxCiutat_SelectedIndexChanged(object sender, EventArgs e)
 {
     dataGridViewHotels.DataSource = SentenciaSQL.obtenirHotelsDeCiutat((int)comboBoxCiutat.SelectedValue);
 }