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]);
- }
- }

Salman BegRank #284 · 8.8K reputationPosted Jan 18, 2017, 9:11 PM EST
Ajit NRank #5,629 · 292 reputationPosted Jan 18, 2017, 9:14 PM EST
Salman BegRank #284 · 8.8K reputationPosted Jan 18, 2017, 9:22 PM EST
Ajit NRank #5,629 · 292 reputationPosted Jan 18, 2017, 10:03 PM EST