Not seeing anyway of creating an index for menu items. Are we meant to return to the days of creating a procedure for each menu element, or am l missing something here?
Printable View
Not seeing anyway of creating an index for menu items. Are we meant to return to the days of creating a procedure for each menu element, or am l missing something here?
well, so far I have answered all of your questions wrong:D this is another one:D:D:D:Quote:
Originally posted by jritchie
Not seeing anyway of creating an index for menu items. Are we meant to return to the days of creating a procedure for each menu element, or am l missing something here?
control arrays dont exist in vb.net, so the menu items dont return an index. and no, you dont have to create a sub for each one. You add the menu name after the handles statement. kinda like this:
probably another wrong answer, but I tried:pVB Code:
Private Sub Menu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) [color=red][b]Handles[/b][/color] MenuItem2.Click, MenuItem3.Click ' , Control.Event, Control.Event, .............. End Sub
Thanks Mr P.... damn MS taking the control arrays out..... *grumble*
If you like to add an event handler at runtime, you can use AddHandler.
Im glad they took em out. They are unnecessary at best in .NET. First off, since everything is an object anyway, you can have an array of objects, but not like the control array as you maybe used to, but still virtually the same idea. But also since when you create controls, you addthem to a control collection which makes using a control array a wasted of recources since now you have in sense, 2 collections of the same controls. Wasteful!Quote:
Originally posted by jritchie
Thanks Mr P.... damn MS taking the control arrays out..... *grumble*
So Mr Anderson how would you add a menu object to an object array? Simply define the array and pop the menu into it or something?