Hey,

I got excellent help regarding adding tabs to a tabcontrol. Now, how would I got about adding items to a listbox? I'm creating an application that not only adds tabs but allows you to edit the names of the tabs using the listbox. Basically, every time it adds a tab it would add a corresponding listbox item. There's a textbox, so when you click the tab on the listbox, type something in the textbox, and press a button, it changes the name.

I can figure everything out, I just need to know how to add listbox items.

Thanks,
~Zephyr~

The easiest way is to use the Add method of the Items property of the listbox:

myListBox.Items.Add(myObjectToBeAdded);

Added to darkagn`s post...
you can bind listBox control to the datasource (and tabControl as well), which hold some data (the control will get populated "automactically".

Back to your question. If I understood you, You have a textBox, into which user enters some name, this name then transfers to listBox, and automatically creates a new tabPage in tabControl. Am I right?
Or you want only to change name on the tabContol, when user selects an item form listBox? How to add new tab then?

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.