473,815 Members | 3,405 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamically Loading Programs

Our company wants to standardize all our new programs. We are using .NET
2.0 and VB.NET against an Oracle Database and SQL Server Database. One
suggestion was to have a single sign on and based on the sign on, list the
programs available to the user. The user would select the program they want
and it would load the program for them in like an MDI application. I would
like to make this like an MDI form that has a Shell application that
controls the login and display of the programs. The shell application would
have a tool strip and status strip that would apply to all programs. Then
in the shell program display the program. Can this be done with an MDI
program? Any help (documentation ,example etc) would be great. I want to
jump on this ASAP so we aren't doing programs piece meal. Thanks.

John
Mar 28 '06 #1
2 990
BK
Not sure if this will help, but....

I had a need to display options to the user in a tree control. The
available programs (forms) were determined by a security application so
at run time, I didn't know what items may or may not be listed on the
menu tree.

To avoid a very lengthy case/select statements that would need to be
modified everytime I added a new form, I used reflection to solve my
problem.

My wife just called, she's out front waiting for me (we carpool). IF
this sounds like something that might help you, let me know and I'll
share the few lines of code necessary to make this happen.

Bill

Mar 28 '06 #2
BK
Ok, here is the pertinent code:

Private Sub InstantiateObje ct(ByVal FullName As String, ByVal
Container As String, ByVal ObjectName As String)
Try
Dim ExternalAssembl y As System.Reflecti on.Assembly = _
System.Reflecti on.Assembly.Loa dFrom(Container )
Dim CalledForm As BravoBaseForm = _
ExternalAssembl y.CreateInstanc e(FullName, True)
CalledForm.Name = ObjectName
Me.FormOwner.Ad dOwnedForm(Call edForm)
CalledForm.Form User = Me.MenuUser
CalledForm.Frie ndlyFormName = FullName
CalledForm.Show ()
Catch ex As Exception
Dim ErrorMessageTex t As String
ErrorMessageTex t = "Error attempting to run this Option,
contact Software Support" & vbCrLf & _
vbCrLf & "Menuhandler::I nstantiateObjec t" & vbCrLf & _
"Object FullName = " & FullName.Trim & " Container = "
& Container.Trim & _
vbCrLf & "Message: " & ex.Message
Me.MenuUser.Bra voMessage.Handl eMsg(ErrorMessa geText, 2)
Me.MenuUser.Bra voMessage.Handl eMsg(ex.Message , True)
End Try
End Sub

A few things to know/consider. All my forms in this application are
derived ultimately from BravoBaseForm, so I use that as a template to
receive the results of ExternalAssembl y.CreateInstanc e. You could
easily modify this to adapt to other object types.

FullName is the fully qualified name of the object.
Container is the assembly name (usually Exe, but could be a dll)
ObjectName is a unique reference to the form as used in the database
and as a unique id for the running form (we don't allow a form to be
open more than once, you could adjust this pretty easily).

Here is how these parts fit together:

If I have an assembly that compiles as Foo.Exe and there is a form
named FindWidgets.Vb and it is listed in my security table with a
unique id of FindWidget, then I'd call this function as follows:

InstantiateObje ct("Foo.FindWid gets", "Foo.Exe", "FindWidget ")

The heavy lifting in this function is these two lines:

Dim ExternalAssembl y As System.Reflecti on.Assembly = _
System.Reflecti on.Assembly.Loa dFrom(Container )
Dim CalledForm As BravoBaseForm = _
ExternalAssembl y.CreateInstanc e(FullName, True)

The first one basically creates a pointer to the Assembly, Foo.Exe in
my example (Ok, I know there aren't really pointers in .NET, but I'm
old school). The second line drills into the assembly and creates an
instance of the class named Widgets.Vb in my example.

Hopefully this helps!

I'm sending a reply to your email and also posting it in the group for
others to use.

Bill

Mar 29 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3024
by: Kamal Jeet Singh | last post by:
Hi Friends !! I am have facing problem in controlling the dynamically created controls on web page. The problem Scenario is Scenario:- My requirement is to load the web user controls on the web page dynamically. To do this, First I including a web page (MainPage.aspx) and I made form tag to Runat=Server. I included one table tag and also made this table Runat=Server side. Second I created three Web User Controls e.g....
1
2581
by: Kamal Jeet Singh | last post by:
Hi Friends !! I am facing problem in controlling the dynamically created controls on web page. The problem Scenario is Scenario:- My requirement is to load the web user controls on the web page dynamically. To do this, First I including a web page (MainPage.aspx) and I made form tag to Runat=Server. I included one table tag and also made this table Runat=Server side. Second I created three Web User Controls e.g. wucCustomerInfo.ascx,
3
1673
by: h4nne5 | last post by:
hi! i would like to create a website where you can browse really high definition images of mine. they are huge and loading them as one would take ages and would probably give some problems to the browser. so i was thinking about loading them dynamically. i'm looking for a good solution to make them easily scrollable/zoomable and dicovered this really cool javascript: http://www.inav.ex-ic.net/map.html does somebody know something similar...
6
6879
by: Dan Dorey | last post by:
I actually have two questions here, but I'll start by giving an outline of what I'm trying to do. I'm building an app with a simple plugin architecture (all in the same app domain). I have each plugin in a separate sub-dir inside a "Plugins" directory. Each plugin consists of at least two DLLs (a controller and a driver). However, most drivers also rely on other external DLLs. In one particular case this dependency is to a C++ DLL...
2
1805
by: A.Wussow | last post by:
Hi Everybody, i want to load dynamically content from some user controls (with forms, or some data-controls) using atlas. So i use an UpdatePanel for loading the user control into a placeholder. Using buttons for loading new content works fine. But i still want to use a function which is callable per javascript. I think this way is more flexable than using the Buttons, becaus every button needs it's own Sub-Routine. But i want to have...
1
1846
by: Bob Rock | last post by:
Hello, I'm new to ASP.NET and I've been looking into the topic of dynamically loading (typically accomplished with a LoadControl followed by a MyControl.Controls.Add()) both user controls and asp.net web controls. I searched for articles on the internet and in the end I must say that I'm confused. I read about issues related to: a.. events not firing
36
3209
by: Martin Larsen | last post by:
Hi, When a PHP program links to a library using include or require (or their _once variations), is the library then linked dynamically or statically? While it might seem irrelevant from a technical point of view, the linking method is important when it comes to licencing issues as some licences, like GPL, differ between those kinds of linking when it comes to viewing the library as a derivative work of the main program.
2
5117
by: Smithers | last post by:
I have a Windows Forms application that implements a plug-in architecture whereby required assemblies are identified and loaded dynamically. Here are the relevant classes: A = application = Windows Forms class B = a singleton hosted within A. B is responsible for dynamically loading classes X, Y, and Z.
20
4307
by: Nickolai Leschov | last post by:
Hello all, I am programming an embedded controller that has a 'C' library for using its system functions (I/O, timers, all the specific devices). The supplied library has .LIB and .H files. How can I dynamically load a LIB file and access all its functions? Surely someone has solved similar task? My intention is to use a Forth system for programming the controller,
0
9735
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9610
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10408
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10426
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10142
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9225
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6897
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4358
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3030
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.