Assigning items to a ComboBox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to assign items from an existing combobox to another
empty combobox.Could you give me the code to do so.
 
Try this

//create a new object array with the size of 1st combo box
object [] obj = new object[comboBox1.Items.Count];

//copy 1st combo box items to the array
comboBox1.Items.CopyTo(obj,0);

//add it to 2nd combo box
this.comboBox2.Items.AddRange(obj);

Shak
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top