Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Visual Studio toolstrip - add or remove buttons run-time

Status
Not open for further replies.

meryls

Technical User
Nov 20, 2003
62
US
I am writing an app in VB.net using Visual Studio 2008.

I need a toolstrip with buttons that the user can add/remove or move. I expected the Visual Studio toolstrip to behave like the toolstrips in Microsoft products, e'g', Visual Studio, Outlook, etc., which allow the user to edit which buttons are viewed.

I cannot see how this functionality is implemented. I cannot even find references to it in the Microsoft documentation.

Anyone have any information that can help me??
Thanks so much!
Meryl
 
Here's an example. You should be able to figure it out from here

Code:
        Dim tsb As New ToolStripButton
        tsb.Text = "Test button"
        tsb.Width = 100
        Me.ToolStrip1.Items.Add(tsb)
 
Thanks, RiverGuy, for a quick reply. I think you are showing me how I can code this at run-time, but my question is how does the toolstrip itself handle the user deciding to remove a button off the toolstrip, i.e., customizing what is on it. When you are using Microsoft Word, you can add or remove buttons like Print from the toolbar. The next time you use Word, the changes you made are remembered.

This is the functionality I am looking for.

Meryl
 
Sounds like you'll need a config/ini/reg entry to keep track of all the changes that are made to the tool bars. You'll then read that file on load and write back any settings as they change.

--------------------------------------------------
"...and did we give up when the Germans bombed Pearl Harbor? NO!"

"Don't stop him. He's roll'n."
--------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top