|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Programmatically add Sub Menus to a ContextMenuStripHi All,
I've always so far designed menus at design time and never had a problem. Today I want to create menus programmatically and add Sub Menus to a ContextMenuStrip. How can I programmatically reproduce what I do at design time by setting the DropDown property of a Menu Item to the Sub Menu I wat to attach to it? The DropDown property doesn't exist on a ToolStripItem and I've tried to play with the Owner property without any luck. Any help or pointer would be greatly appreciated. Thanks JB "JB" <jb.bross***@gmail.com> schrieb: Just check the button on top of the solution explorer to show hidden files. > I've always so far designed menus at design time and never had a > problem. > Today I want to create menus programmatically and add Sub Menus to a > ContextMenuStrip. > How can I programmatically reproduce what I do at design time by > setting the DropDown property of a Menu Item to the Sub Menu I wat to > attach to it? > > The DropDown property doesn't exist on a ToolStripItem and I've tried > to play with the Owner property without any luck. Then navigate to the "<form name>.Designer.vb" file of a form on which you already added the toolstrip. It will contain the source code generated by the designer to set up the menu. This should give you an idea on how to create the menus. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Show quote
Hide quote
On 5 Apr, 17:28, "Herfried K. Wagner [MVP]" <hirf-spam-me-h...@gmx.at> Thanks very much for that tip Herfried. I found the trick. Thewrote: > "JB" <jb.bross***@gmail.com> schrieb: > > > I've always so far designed menus at design time and never had a > > problem. > > Today I want to create menus programmatically and add Sub Menus to a > > ContextMenuStrip. > > How can I programmatically reproduce what I do at design time by > > setting the DropDown property of a Menu Item to the Sub Menu I wat to > > attach to it? > > > The DropDown property doesn't exist on a ToolStripItem and I've tried > > to play with the Owner property without any luck. > > Just check the button on top of the solution explorer to show hidden files. > Then navigate to the "<form name>.Designer.vb" file of a form on which you > already added the toolstrip. It will contain the source code generated by > the designer to set up the menu. This should give you an idea on how to > create the menus. > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://dotnet.mvps.org/dotnet/faqs/> designer uses a ToolStripMenuItem class and not a ToolStripItem as returned by the ToolStripItemCollection.Add function.
HTML report in vb.net
master - detail architecture for dataTable. textBox databinding. Sorry for reposting - can not figure out... Reading filenames into listbox Object disposal guidance needed Trouble With Timer Red TransparencyKey Not Working on Non Development Computer Add timer.tick event handler. Create a template. |
|||||||||||||||||||||||