S
Steve_Black
Hello,
I'm toying with the idea of loading a MenuStrip (VB.Net 2005)
dynamically based on who is logged into my system. Every user has
different security settings and I want to customize the main menu
instead of showing all possible options and only enabling/disabling
certain ones.
I have a table that stores the menu item name, parent item (if
applicable), display order, etc. so that I can dynamically load my
menu. There's also a column called "FormToOpen". If that particular
field is populated, I obviously want to open the specified form if the
menu item is clicked. I have a field called 'ReportToOpen'. If that
particular field is populated, I want to open a SQL Server Report
(utilitizing Reporting Services) when the menu item is selected. And
lastly, I have a field called "RoutineToCall". If that field is
populated I want to call the routine.
I suppose I could add all the menu items, place the appropriate code
behind each item, and then remove items from the menu if they're not
applicable.
I have a couple of questions:
1. Should I scratch what I'm thinking and just go with my second
option above, namely just adding all the items and code at design-time
and just removing unneeded items, or
2. Go about what I'm trying to do. And if so, how? How do I open a
form if the name of the form is stored in a database field. How do I
call a sub routine if the name of the routine is stored in a database
field?
Thanks a lot.
Steve
I'm toying with the idea of loading a MenuStrip (VB.Net 2005)
dynamically based on who is logged into my system. Every user has
different security settings and I want to customize the main menu
instead of showing all possible options and only enabling/disabling
certain ones.
I have a table that stores the menu item name, parent item (if
applicable), display order, etc. so that I can dynamically load my
menu. There's also a column called "FormToOpen". If that particular
field is populated, I obviously want to open the specified form if the
menu item is clicked. I have a field called 'ReportToOpen'. If that
particular field is populated, I want to open a SQL Server Report
(utilitizing Reporting Services) when the menu item is selected. And
lastly, I have a field called "RoutineToCall". If that field is
populated I want to call the routine.
I suppose I could add all the menu items, place the appropriate code
behind each item, and then remove items from the menu if they're not
applicable.
I have a couple of questions:
1. Should I scratch what I'm thinking and just go with my second
option above, namely just adding all the items and code at design-time
and just removing unneeded items, or
2. Go about what I'm trying to do. And if so, how? How do I open a
form if the name of the form is stored in a database field. How do I
call a sub routine if the name of the routine is stored in a database
field?
Thanks a lot.
Steve