public void CustomerRating(string s, ComboBox combobox2, ComboBox combobox3) { try { SqlDataReader dr; dr = dw.CustomerRating_2(s); combobox2.Items.Clear(); combobox2.ResetText(); combobox3.Items.Clear(); combobox3.ResetText(); while (dr.Read()) { if ((!combobox2.Items.Contains(dr["brandname"]) && (dr["brandname"] != ""))) { combobox2.Items.Add(dr["brandname"]); } if ((!combobox3.Items.Contains(dr["size"]) && (dr["size"] != ""))) { combobox3.Items.Add(dr["size"]); } } combobox2 = null; combobox3 = null; } catch (Exception e) { MessageBox.Show(e.Message); } }