473,387 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Loading an assembly

Hi Guys & Gals

I'm developing a windows application that is seperated
into logical units. these units are created as user
controls and are loaded at runtime. I'm having a problem
getting the user control to load, I'm using reflections
and createinstance method, but nothing is happening, I
have used this method sometime ago and I cannot remember
the full syntax. this is what I've got so far...

Imports System.Reflection

Private sub LoadModules()
dim Asm as System.Reflection.Assembly
Asm = System.reflection.assembly.loadfrom
("c:\App\bin\IPSMC001.dll")

I thought at this point I create an object and set a
reference to the Asm.createinstance("MC001") like

dim obj as object
obj = Asm.createinstance("IPSMC001.MC001")

but the object is nothing

Any ideas thanks
Duncan

Jul 21 '05 #1
1 1418
Hi,

You could alternatively use

AppDomain.CurrentDomain.CreateInstanceFromAndUnwra p(...)

"Unwrap" is important because you will be getting an object handle instead
of a real object otherwise.
dim obj as object
obj = Asm.createinstance("IPSMC001.MC001")

but the object is nothing
This sounds strange. Not sure about the Assembly's CreateInstance, but the
AppDomain's one should throw an exception when it is unable to instantiate
the requested type.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Duncan" <in**@e-ips.co.uk> wrote in message
news:06****************************@phx.gbl... Hi Guys & Gals

I'm developing a windows application that is seperated
into logical units. these units are created as user
controls and are loaded at runtime. I'm having a problem
getting the user control to load, I'm using reflections
and createinstance method, but nothing is happening, I
have used this method sometime ago and I cannot remember
the full syntax. this is what I've got so far...

Imports System.Reflection

Private sub LoadModules()
dim Asm as System.Reflection.Assembly
Asm = System.reflection.assembly.loadfrom
("c:\App\bin\IPSMC001.dll")

I thought at this point I create an object and set a
reference to the Asm.createinstance("MC001") like

dim obj as object
obj = Asm.createinstance("IPSMC001.MC001")

but the object is nothing

Any ideas thanks
Duncan


Jul 21 '05 #2

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

Similar topics

2
by: Foehammer | last post by:
Hello, I'm trying to load an assembly dynamically using an app domain. This is a proof-of-concept for a larger project, so please excuse the lame class names. TestLib is the dll where all the...
4
by: Mark | last post by:
I wan't to be able to deserialize a class from an assembly that is not in the application domain. To do that I must have the Type from the Assembly. How do you get a Type from an assembly that is...
1
by: Benjamin | last post by:
Hi, I'm currently writing a Web Services that interacts with a database. To allow me to use not just one database provider (for example, I could use MS Access, SQL Server or MySQL), the Web...
9
by: Ender | last post by:
I have an application that I would like third party developers to be able to create Plug-ins that will be dynamically loaded into our application to extend functionality. I have utilized the...
6
by: Pete Davis | last post by:
I'm confused about what precisely the limitations are on loading plugins in separate app domains. In all my previous apps that supported plugins, I've loaded them into the same domain as the app,...
1
by: Brian | last post by:
I've looked through the previous posts on this one and have verified permissions and location of my Dlls, but I am still getting an exception when I try to Load an assembly. The directory where...
4
by: ali.jan | last post by:
Hi, It is trivial to load an assembly in a new Application Domain. Is there any way of loading an assembly in a new process? I tried using the Process class like this: Process p = new...
1
by: John F | last post by:
Hello all, When dynamically loading classes through reflection using Assembly.LoadFrom I have the following questions: 1) Once you load an assembly it doesn't appear you can unload it. If you...
5
by: Mantorok | last post by:
Hi I have a project that references one of our components, is there a way in ..Net to get a list of references that the application is depending on? The reason for this is so I can load...
1
by: =?Windows-1252?Q?Tor_B=E5dshaug?= | last post by:
BlankHi, I am having trouble loading assemblies from the database in my ASP.NET app. I have a default.aspx in my app that is served from a database via a custom virtual path provider. This works...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...

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.