E
Eric Sabine
This app will fill a datatable from sql server at load time (and can clear
and reload it again if the user requests it). The contents of the data table
contain program names and program groups. For example
Accounting
ACT123
ACT456
ACT789
Production
PRO123
PRO234
Shipping
SHP432
SHP678
etc.
The data from this datatable will be iterated through and for each entry,
i.e., ACT789 under the Accounting menu, a new menu item will be added to the
context menu.
When the user opens the context menu during run time, in this case they
would see the 3 groups and could then move right on each one and see the
programs under each group. If the user picks say ACT123 then that accounting
program would then open. Simple stuff.
But the data table is user dependent so the list will be different for every
user. Adding menu items to the data table from code seems easy enough, but I
think what will be the hard part is reacting to each click event for the
different menu items. Regardless of which program is clicked, they call call
the same method in the end, i.e., Private Sub RunProgram (ByVal ProgramExe
as String) ....
So how can I react to the click events at run time when I build the menu
list of the context menu dynamically? Basically it seems that somehow
during runtime, I will need to react to each of clicks , i.e., Sub X ()
handles ContextMenuItem.Click, but since the controls are added at runtime,
how to I process each's click event?
Eric
and reload it again if the user requests it). The contents of the data table
contain program names and program groups. For example
Accounting
ACT123
ACT456
ACT789
Production
PRO123
PRO234
Shipping
SHP432
SHP678
etc.
The data from this datatable will be iterated through and for each entry,
i.e., ACT789 under the Accounting menu, a new menu item will be added to the
context menu.
When the user opens the context menu during run time, in this case they
would see the 3 groups and could then move right on each one and see the
programs under each group. If the user picks say ACT123 then that accounting
program would then open. Simple stuff.
But the data table is user dependent so the list will be different for every
user. Adding menu items to the data table from code seems easy enough, but I
think what will be the hard part is reacting to each click event for the
different menu items. Regardless of which program is clicked, they call call
the same method in the end, i.e., Private Sub RunProgram (ByVal ProgramExe
as String) ....
So how can I react to the click events at run time when I build the menu
list of the context menu dynamically? Basically it seems that somehow
during runtime, I will need to react to each of clicks , i.e., Sub X ()
handles ContextMenuItem.Click, but since the controls are added at runtime,
how to I process each's click event?
Eric