Hi, I want to refresh the combobox. when i update data in child form, the combobox will be update in parent form. i tried following code it will update, but in combobox it also displayed the previous data.
so help me how can i refresh combobox ?
This is my code....
- private void StudentRegistration_Load(object sender, EventArgs e)
- {
- cmbclass.Items.Clear();
- FillClass();
- }
-
- public void FillClass()
- {
- SqlCommand cmdfill = new SqlCommand("select Class from AddClass", con);
- SqlDataReader drfill = cmdfill.ExecuteReader();
- while (drfill.Read())
- {
-
- cmbclass.Items.Add(drfill[0]);
- }
-
- }