I want to add a new item to combobox at runtime. Actually in my form i am having a textbox,combobox . After entering item name in textbox the new item has not to added to the combobox items list at runtime..give me the solution....post code plz

Ketsuekiame commented: No effort by yourself, no code of your own posted, demanding code...This is just rude. Daniweb is not your personal out-sourcing company. -2

Recommended Answers

Just use something like
comboBox1.Items.Add("My new combo item");

Jump to Post

All 2 Replies

Just use something like
comboBox1.Items.Add("My new combo item");

Hey

The above code will work if you want to hardcode your combo box values, however, if you want combo box to have the values you enter in a text box from the form then, you can do the following.

comboBox1.Items.Add(textBox1.text);

HTH
BB-SA

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.