VS2005
Can anyone show me- if its possible- how to clone a combo box .
I have 6 combo boxes on a windows form all contain the same information. After the first only I only want to load the data when the cbo is selected.
If you cannot clone a combo box where and how would I check that the cbo is empty

Cloning
fddsfsdf
Thanks that helps.
In regards to the second part
I was populating them all (from a database) in the load event but this takes too much time. so I only want to populate the cbo if its selected, but I am not sure in which event to do this.
mvsure
Not extactly,
In the Form_Load event
if cboB is selected I want to populate from cboA.
Its where (if cboB is selected ). that I need to know where to put
foreach(object curObject in this.theComboBoxSource.Items)
{
this.theComboBoxDestination.Items.Add(curObject);
}
I also only want to populate cboB once, even if the selected index is changed .
Devi48354
C. Charpentier
OK, well, just check to see the number of items items in comboboxB.
If number of items == 0 then populate
//SelectIndexChanged Event
if (this.comboBoxB.Items.Count == 0)
{
//populate data/copy/whatever
}
does this help
Michael G. Emmons
Thanks that helped but it didnt work when in the selectedindexchanged event
I works when in the dropdown event.
tfavier
if the combobox is empty, check the number of items stored:
this.theComboBox.Items.Count
how exactly do you mean "clone" do you mean copy contents of 1 combo box into another if so, just loop through the items and copy them over to the desired combobox. Example:
foreach(object curObject in this.theComboBoxSource.Items)
{
this.theComboBoxDestination.Items.Add(curObject);
}
I don't quite understand this part, are you able to ask a bit more
Do you mean loading data from a file/database