private void cmb_name1_SelectedIndexChanged(object sender, EventArgs e) { if (cmb_type_2.SelectedIndex == 0) { cmb_module_2.DataSource = General_methods.fill_module_combobox(General_methods.get_course_no_from_course_name(cmb_name1.Text)); } else { cmb_module_2.Enabled = false; } }
private void cmb_name_SelectedIndexChanged(object sender, EventArgs e) { con.Open(); SqlCommand cmd = new SqlCommand("SELECT course_no FROM Course_details_master WHERE course_name='" + cmb_name.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); if (dr.HasRows) { txt_no.Text = dr.GetValue(0).ToString(); } else { /* dr.NextResult(); * dr.Read(); * if (dr.HasRows) * { * txt_no.Text = dr.GetValue(0).ToString(); * } * else * { * dr.NextResult(); * dr.Read(); * txt_no.Text = dr.GetValue(0).ToString(); * }*/ } if ((cmb_type.SelectedIndex == 0 || cmb_type.SelectedIndex == 1) == false) { txt_progtitle.Text = cmb_name.Text; } dr.Close(); if (cmb_type.SelectedIndex == 0) { cmb_module.DataSource = null; cmb_module.DataSource = General_methods.fill_module_combobox(General_methods.get_course_no_from_course_name(cmb_name.Text)); } con.Close(); }