how can i Add to dropdown list duing runtime in visual studio.Suppose i have 4 list items in drop down and one of the option is to add a new item.What i want to do is when i select that option(create new) i should be able to add the fifth option in the list.

Thanks

What have you tried already?

how can i Add to dropdown list duing runtime in visual studio.Suppose i have 4 list items in drop down and one of the option is to add a new item.What i want to do is when i select that option(create new) i should be able to add the fifth option in the list.

Thanks

Hello,

First setup a textbox (for the item to be added), then a button to add it.

when clicking the button type

combobox1.Add.Items(textbox1.text)

almost had it.

combobox1.Items.Add(textbox1.text);

almost had it.

combobox1.Items.Add(textbox1.text);

doh, thanks for that. I'm still learning :)

Thanks for the reply guys.What i am trying to do is user can add to the drop down liast and that drop down list should then be inserted in the databse under the category column.so suppose i have list item as ...add, animal , buildings, now if the user click on add list item he should be able to enter new list item and at the same time should be able to insert it in databse.

Be a part of the DaniWeb community

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