From: shoosh on

That's it.

Thank you, thank you, and thank you.


"Armin Zingler" wrote:

> Am 09.04.2010 03:59, schrieb shoosh:
> >
> > I think the missing element in my code is that "mi" refers to an object, but
> > the add method simply adds a sub-menu item with the text "Test Item 3".
> >
> > mnuRecentProjects.DropDownItems.Add(mi) generates an error, as the add
> > method doesn't expect an object here.
>
> mi.text is a String which is also an Object. Everything is an object.
> However, the problem is that you use a MenuItem instead of a ToolStripMenuItem.
> The MenuItem is used with the old menus. You are using the newer MenuStrips.
>
> > mnuRecentProjects.DropDownItems.Add(mi.Text) works to add the sub-menu item,
> > but this menu item does not equate to the "mi" object.
> >
> > How do I assign the "mi" object to the sub-menu item created with the
> > preceding add method?
>
> Dim mi As New ToolStripMenuItem("Test Item 3")
> AddHandler mi.Click, AddressOf MenuItem_Click
> mnuRecentProjects.DropDownItems.Add(mi)
>
> - or -
>
> Dim mi As ToolStripItem
> mi = ItemsToolStripMenuItem.DropDownItems.Add("Test Item 3")
> AddHandler mi.Click, AddressOf MenuItem_Click
>
> - or -
>
> mnuRecentProjects.DropDownItems.Add("Test Item 3", Nothing, AddressOf MenuItem_Click)
>
> or, or,...
>
>
> --
> Armin
> .
>
First  |  Prev  | 
Pages: 1 2
Prev: ASP Tab Control
Next: Gridview order