0

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~

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Mitja Bonca
0

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

myListBox.Items.Add(myObjectToBeAdded);
0

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?

Edited by Mitja Bonca: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.