Monday, June 7, 2010

How to Load a Form Dynamically in Visual Basic .Net

Once you know the name of the DLL and the name of the form you want to show, the rest is quite simple. You create an instance of the form, using the Assembly.CreateInstance method, and then call the Show method on the form. The following code snippet is a simplified version of the code in the Dynamic­App Dashboard.Button_Click_Handler method. It demonstrates how to load a DLL called MyDll.dll, create an instance of a form within the DLL Form1, and show the form.
Dim asm As Reflection.Assembly
Dim f As Form
asm = asm.LoadFrom("MyDll.dll")
f = CType(asm.CreateInstance("MyDll.Form1"), Form)
f.Show()
Notice with the CreateInstance method that we have to refer to the form as MyDll.Form1, using the <namespace>.<formname> format. Also be aware that when you write code that loads a DLL dynamically, all names, including the filename and type name, are case sensitive.

5 comments:

MLM Software said...

Thanks for info.


Pooja

MLM Developers India

http://mlmdevelopers.com/products/mlm-software/corporate-mlm-soft/feature.html

Prince Brown said...

ARIES TECH SOFT PVT LTD provides you with the best MLM(MULTI LEVEL MARKETING) software in binary as well as matrix form.MLM Software is very important and critical to your business success. MLM Software which is really a life line of any MLM company. MLM companies are running on trust. Without online software, it's really difficult to run your MLM Company. So before deciding for online software for your company, you need to examine the brief history of company.



mlm software Delhi

Unknown said...

I need a VB.Net application that can connect with a Fingerprint Device and save data in mysql. Device - http://www.digitalpersona.com/Fingerprint-Biometrics/Fingerprint-Readers/U-are-U-4500-Reader/. Is it possible ? Give me development cost.

Anonymous said...

We are a new start-up that is beginning.
We need a little procedure in VISUAL BASIC .NET that will generate automatically a screen from a database.
The parameters are the name of the database and the fields that are going to be show, as:
Database: Name of database where is saved the information to be shown, and were fields will be added, deleted and amended.
Field1: Name of first field from “Database” to be shown (database.field1)
RelatedDatabase1: If blank, the information to be shown is: database.field1.
If not blank means that “Field1” is a code (Not the description), and the description to be shown is “RelatedDatabase1.Description” using next relation “database.field1=RelatedDatabase1.code”
Field2: Name of second field from “Database” to be shown (database.field2)
RelatedDatabase2: If blank, the information to be shown is: database.field2.
If not blank means that “Field2” is a code (Not the description), and the description to be shown is “RelatedDatabase2.Description” using next relation “database.field2=RelatedDatabase2.code”
Field3: ….
RelatedDatabase3: ….
Field4: ….
RelatedDatabase4: ….


WE OFFER YOUR FOR IT 50€.
Please ONLY interested person or group contact us at you_have_the_mind_we_have_the_money_so_we_are_going_to_win@hotmail.com for any question.

Kids Place Reggio said...

Great post thankyoou

Post a Comment

 
Powered by Blogger