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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

1 Toolstrip control used on all forms in project 1

Status
Not open for further replies.

surfside1

Programmer
Feb 12, 2006
209
US
I'm thinking I should be able to find this out in help or on the web, but I haven't found anything.

I'm building a project that I want each form to use the same toolstrip without recreating it in every form. I can add it to my template, but is there something else that can be done for each individual form where one of the buttons links to that form without commenting out the click event for that button?

Also, can anyone tell me where I can get a list of all the methods and what they do?
 
I've not tried this, but in theory it should work. Not knowing what you need it all for there may be some things you still need to do missing from my answer. There are several ways you could do this. If you can inherit from the tool strip make a class that does so. First make a stripped down version of the form then make each new form you are going to create into a class. If you can just inherit to form you can do that (never tried to see if you can inherit a specific object or only the type of object) or you just make a new instance of that form. That does mean you will have to programmatically add all the additional things you want on the form (if you can't inherit).

This makes certain assumptions though. I would really suggest giving a little more information on why you want to though. I mean you could really go even simpler and just put all the code you want to have in the toolbar button clicks in functions and call those functions from wherever you wanted. What makes the tool bar so special that the exact one needs to be on each form?

-I hate Microsoft!
-Forever and always forward.
 
Thanks for responding. I'll give some thought to what you said. The main reason that I wanted the same one for each form was mainly uniformity and I didn't want to remake the toolbar in each form.
Thanks again.
 
It was better if you create your app as an MDI. Then you need only a toolbar. You can enable/Disable/change menu items at runtime

________________________________________________________
Zameer Abdulla
Help to find Missing people
 
Yeah.. forgot to mention..
You can add controls at runtime.
Code:
    Private Sub [b]Form2_Load[/b](ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Me.Controls.Add([b]Form1.ToolStrip1[/b])
    End Sub


________________________________________________________
Zameer Abdulla
Help to find Missing people
 
Thanks, I might try them both. I haven't done either one so it'll be great to try. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top