hi all,
i have an mdi form with a menustrip.. File Edit View
i have an mdi child with a menustrip... Tools Actions
i want to be able to add the Tools Actions to the menu in my mdi and not show them in my mdichild.
is that possible?
thanks.
Printable View
hi all,
i have an mdi form with a menustrip.. File Edit View
i have an mdi child with a menustrip... Tools Actions
i want to be able to add the Tools Actions to the menu in my mdi and not show them in my mdichild.
is that possible?
thanks.
Hey,
If I have understood you correctly, then yes, this is possible, but you are going to need to handle some of this yourself, as I am not aware of a way of doing it automatically.
For instance, in the load event of your child form, you could have something like this:
Depending on how you are wanting to do things, you may need to remove this menu item again when the child form closes.Code:Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim parentForm As Form1
parentForm = Me.MdiParent
Dim newMenuItem As New ToolStripMenuItem
newMenuItem.Text = "Test"
AddHandler newMenuItem.Click, AddressOf newMenuItem_Click
parentForm.MenuStrip1.Items.Add(newMenuItem)
End Sub
Private Sub newMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
MessageBox.Show("New Item Clicked")
End Sub
Thinking about it, you may be able to create the menu on the child form at design time, then programmatically loop through them at runtime and add them to the parent form, and then hide the menu on the child form. I will go and give that a try.
Hope that helps!!
Gary
Hey,
This seems to work:
Hope that helps!!Code:Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim parentForm As Form1
parentForm = Me.MdiParent
parentForm.parentMenu.Items.AddRange(Me.childMenu.Items)
Me.childMenu.Visible = False
End Sub
Gary
Can't you use Merging for that? It can do it automatically.
EDIT
You don't need to even set any properties, it works automatically.
Create a main form with IsMdiParent = True. Put a MenuStrip on it with the menus "File", "Edit" and "View".
Create a child form with a MenuStrip with the menus "Tools" and "Actions".
Use a button or something to create your mdi child, and the Tools and Actions menus should be merged into the main forms MenuStrip, besides, File, Edit, View.
vb.net Code:
Dim f As New FormMdiChild f.MdiParent = Me f.Show()
Hey,
Looks like you could be onto something there Nick, a quick google revealed this:
http://msdn.microsoft.com/en-us/library/ms404319.aspx
Good to know!!
Gary
thanks all.
found this thread very helpful.
hi all,
i know this thread is resolved but i'm having a problem somewhat related to this one...
i am able to do this using the Menu Strip but how do i do this using the ToolStrip.. i tried doing the same logic as the MenuStrip but somehow it doesn't seem to work with the ToolStrip.
can someone help me with this?
thanks
Hey,
I think this might help you out:
http://msdn.microsoft.com/en-us/libr...40(VS.80).aspx
This links through to a complete walkthrough:
http://msdn.microsoft.com/en-us/libr...76(VS.80).aspx
Gary
hi,
thanks for the info...
i did follow both links but it only goes until the merging of menustrip and menustrip items but it doesn't go as far to merging toolstrip and toolstripbuttons.
i'm still looking for some other ways as of now... i'd appreciate any help.
thanks.
Hey,
Ok, just done some more digging around, and I have come up with the following:
http://jdixon.dotnetdevelopersjourna...pplication.htm
Hopefully this will answer your question.
Gary
hi,
thanks... this works... it's a little sad though that the automerging is not applicable in toolstrip unlike menustrip.
i did find a thread in the microsoft forums wherein it was said that only menustrip can do automerge... i hope they make this applicable in toolstrip as well in the future.
Yeah, I am finding some references suggesting that it does work automatically, but everything I have seen so far (including testing) suggests that it doesn't, which is a bit of a shame.
At least you have it working though, that's the main thing.
Gary
Hey,
I know this is an older thread, but I have just been doing some reading, and I came across this:
http://msdn.microsoft.com/en-us/libr...r_members.aspx
Specifically the Merge Method:
http://msdn.microsoft.com/en-us/library/5523fet0.aspx
Hope that helps!!
Gary
thanks... i'll check it out.