private void comboBox4_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox4.Text != "Select Floor") { comboBox7.Items.Clear(); comboBox7.Items.Add("Select Room"); comboBox7.Text = "Select Room"; comboBox7.Enabled = true; PlaceAppointmentmysql findroom = new PlaceAppointmentmysql(); List <string> rooms = findroom.FindRooms(int.Parse(comboBox4.Text)); foreach (var item in rooms) { comboBox7.Items.Add(item); } } else { comboBox7.Items.Clear(); comboBox7.Items.Add("Select Room"); comboBox7.Text = "Select Room"; comboBox8.Items.Clear(); comboBox8.Items.Add("Select Bed"); comboBox8.Text = "Select Bed"; comboBox7.Enabled = false; comboBox8.Enabled = false; } }