I am working on a c# winforms program that has three comboboxes, each combobox has a different displaymember, valuemember, and datasource. I would like to try to create a method in which I can use to set the member values and datasource that works for all three comboboxes
here is what I am currently using for the comboboxes
private void kitLoad (string kitDisplay, string kitValue, object kitSource)
{
kits_comboBox.DisplayMember = kitDisplay;
kits_comboBox.ValueMember = kitValue;
kits_comboBox.DataSource = kitSource;
}
private void pspLoad(string pspDisplay, string pspValue, object pspSource)
{
psp_comboBox.DisplayMember = pspDisplay;
psp_comboBox.ValueMember = pspValue;
psp_comboBox.DataSource = pspSource;
}
private void plateLoad(string plateDisplay, string plateValue, object plateSource)
{
plates_comboBox.DisplayMember = plateDisplay;
plates_comboBox.ValueMember = plateValue;
plates_comboBox.DataSource = plateSource;
}
It does work, But I feel like I could compress all of that into one method, any help is greatly appreciated.
just pass your combo along
will work for any combo box