*Experts* DiverDan Posted January 27, 2003 *Experts* Posted January 27, 2003 Is it possible to combine the toolbar menu with the main menu so that both can share the same commands? Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
*Gurus* divil Posted January 27, 2003 *Gurus* Posted January 27, 2003 No, you'll have to call one from the other. This is unfortunate, and many third-party controls for drawing "nice" toolbars and menus operate this way, but not the tools that are provided by default. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
*Experts* DiverDan Posted January 27, 2003 Author *Experts* Posted January 27, 2003 So if I understand you correctly... If I want to show an about screen from the main menu and program a show dialog to display it, then I also have to program the same show dialog from the toolbar menu? The two menu commands cannot be connected so the I only need to program the show dialog once? Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
Moderators Robby Posted January 27, 2003 Moderators Posted January 27, 2003 No. your toolbar item can call the menu item like this... mnuFileNew.PerformClick() Quote Visit...Bassic Software
UCM Posted January 28, 2003 Posted January 28, 2003 Or you can create a sub for the code you want to execute and then in both of the events for the menu and the toolbar, have it call the sub... IE: Private Sub RunMyCode() End Sub Private Sub MenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem4.Click RunMyCode() End Sub Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick RunMyCode() End Sub Quote UCM >-)
Moderators Robby Posted January 28, 2003 Moderators Posted January 28, 2003 I still prefer to call all menu items from toolbar items or vice versa. Quote Visit...Bassic Software
*Experts* DiverDan Posted January 29, 2003 Author *Experts* Posted January 29, 2003 Thanks Robby, your method works fantastic! Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.