Re: Dynamically open forms, reports or call functions
- From: tomb <tomb@xxxxxxxxxxxxxxxxx>
- Date: Fri, 14 Apr 2006 16:05:00 -0400
Steve_Black@xxxxxxxxxxxx wrote:
Thanks Tom. I think the answer to your question really relies on howI see. That definitely changes the scope of the situation. From the sound of this, you are building a client-server, rather than a web, program. As far as the SqlServer reports, if it is a report provided by SqlServer, then they can be added as a record. If you are using Crystal Reports within the VB.net environment, then that can also be added to the server, and a report file can actually be stored in the database as a BLOB.
complicated it is to program the dynamic menus. When I say this, I
don't mean actually loading the menu items dynamically. I suspect
that'll be the easy part. I mean opening a form, report or calling a
routine if the name of that form, report or routine is stored in a
variable.
i.e.
--Set Connection properties
--Open datareader--Load Menu and store the appropriate form, report or routine name to
open in the Tag property of the menu item.
--On click of the menu, open the form or report, or call the routine,
that's named in the Tag property.
Depending on how to do this, I don't necessarily agree with you that
the database approach is extremely complicated. For instance, in
Microsoft Access I would simply do a Docmd.OpenForm (menuitem.Tag) or a
Docmd.OpenReport (menuitem.Tag) or an Eval(menuitem.Tag). If I
hardcode the entire menu and then remove items that aren't needed for
particular users, every time I add new functionality I'll always have
to remember to update the menu instead of simply adding another record
to a table. Also, if I'm delivering a new SQL Server report then my
code may not change at all - I just have to add another record to my
table and deliver the report to my clients. If I hardcode the entire
menu and then remove menu items that aren't needed, I'll have to update
the menu every time I add a report and that means I'll have to
re-deploy the application.
Perhaps this is the way I should have asked these questions:
How can I open a form if the name of the form is stored in a variable?
How can I call a routine if the name of the routine is stored in
variable?
I won't ask about opening a SQL Server report...If I can get those two
questions I can figure out this one easily enough.
Thanks again,
Steve
But to look at what you can do dynamically with MS Access and try to find the same thing with VB.net, you will frustrate yourself. Access is a tigthly bound environment, whereas VB and SqlServer are not. Visual FoxPro will allow macro substitution of function and form names, but I haven't seen anything like that in VB. You might want to consider that tool for this particular project.
Based on what you've described though, the approach I would take with VB.net is to include as a function in a dll, the code for building the menus. In the same dll, I would include the dynamic forms. Because the menu is built dynamically, the action to take based on a menu selection can be handled quite easily. A non-changing function call with the form name/function name as a parameter will tell the dll what to do. That way the interface won't change, which will be good when I update the dll with another form or function. Providing the user with an updated dll file will add the new functionality, provided of course that user has the appropriate privileges.
In VB.net, a dll is the only way I can find to "dynamically" provide functionality. When the app is compiled, it needs to know everything.
I hope this helps. It sounds like a fun project.
Tom
.
- Follow-Ups:
- Re: Dynamically open forms, reports or call functions
- From: Steve_Black
- Re: Dynamically open forms, reports or call functions
- References:
- Dynamically open forms, reports or call functions
- From: Steve_Black
- Re: Dynamically open forms, reports or call functions
- From: tomb
- Re: Dynamically open forms, reports or call functions
- From: Steve_Black
- Dynamically open forms, reports or call functions
- Prev by Date: Editing an Excel Work*** with vb.net
- Next by Date: Re: Nothing as a char of a string
- Previous by thread: Re: Dynamically open forms, reports or call functions
- Next by thread: Re: Dynamically open forms, reports or call functions
- Index(es):