Click here to Skip to main content
16,018,904 members
Please Sign up or sign in to vote.
1.33/5 (3 votes)
I need Add Items in Combobox from listbox
Note : Combobox & Listbox in Winform main ,n I mean in One Winform
Posted
Comments
Nuri Ismail 12-Jan-11 4:38am    
What have you tried?
Umair Feroze 12-Jan-11 4:49am    
Please clarify your question. Identify how do you want to add items in ComboBox whether you want to add items using selection of items from listbox or through any other method

1 solution

Ok,
you have MyCombo and MyList on your form

1. handle the DoubleClick event of MyList.
2. Write your code :

C#
private void MyList_DoubleClick(object sender, EventArgs e)
{
    MyCombo.Items.Add(MyList.SelectedItem);
    MyList.Items.Remove(MyList.SelectedItem);
}


Of course "MyList.Items.Remove(MyList.SelectedItem);" is optional.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900