Hello,
My application needs load some dll's at runtime, Is there any way to do it?,
can you show me a working example code?
Many thanks 11 1788
"Juande" <a@b.com> schrieb: My application needs load some dll's at runtime, Is there any way to do it?
Take a look at the documentation for 'System.Reflection.Assembly.Load*'.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Ok thanks,
Now other question please, I have the next code;
Dim Form1 As Form
Form1 =
System.Reflection.Assembly.LoadFrom("MyDLL.dll").C reateInstance("MyDLL.Form2")
Form1.Show()
How can I check if any dll is still loaded?
Many thanks
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> escribió en el mensaje
news:Od**************@TK2MSFTNGP14.phx.gbl... "Juande" <a@b.com> schrieb: My application needs load some dll's at runtime, Is there any way to do it?
Take a look at the documentation for 'System.Reflection.Assembly.Load*'.
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
"Juande" <a@b.com> schrieb: Dim Form1 As Form Form1 = System.Reflection.Assembly.LoadFrom("MyDLL.dll").C reateInstance("MyDLL.Form2") Form1.Show()
How can I check if any dll is still loaded?
The DLL will remain loaded until the appdomain that loaded the DLL and/or
obtained type information from the DLL will be released. If you want to
unload a DLL, you'll have to work with a secondary appdomain and remote
interfaces:
<URL:http://www.west-wind.com/presentations/DynamicCode/DynamicCode.htm>
-> "Understanding how .Net loads code"
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Juande,
I am curious, how were you able to produce this question in such a short
time, did you really investigate this as Herfried sugested?
Cor
Ok,
I have a large C/S Application (sometimes crashes/quits unexpectedly without
any error), I want to divide in modules (dll) and then load the needed ones,
so I've realized a simply application test to load an example dll to check
System.Reflection.Assembly to see how it works, the next step will be check
if the dll is still loaded to doesn't load again.
Herfried; Many thanks for your very quick and useful help.
"Cor Ligthert" <no************@planet.nl> escribió en el mensaje
news:%2****************@TK2MSFTNGP14.phx.gbl... Juande,
I am curious, how were you able to produce this question in such a short time, did you really investigate this as Herfried sugested?
Cor
Sorry, but I've got another problem, as you know, I load at runtime my dll,
this dll contains a class called MyForm, example code on a click button
event;
Dim MyDLL As [Assembly]
MyDLL = System.Reflection.Assembly.LoadFrom("MyDLL.dll")
Dim MyForm As Form
MyForm = MyDLL.CreateInstance("MyDLL.MyForm")
MyForm.Show()
This code works fine, but, I want to prevent that if the form is loaded,
doesn't load other instance, How can I do it?
Many thanks in advance
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> escribió en el mensaje
news:Od**************@TK2MSFTNGP14.phx.gbl... "Juande" <a@b.com> schrieb: My application needs load some dll's at runtime, Is there any way to do it?
Take a look at the documentation for 'System.Reflection.Assembly.Load*'.
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
"Juande" <a@b.com> schrieb: Sorry, but I've got another problem, as you know, I load at runtime my dll, this dll contains a class called MyForm, example code on a click button event;
Dim MyDLL As [Assembly] MyDLL = System.Reflection.Assembly.LoadFrom("MyDLL.dll") Dim MyForm As Form MyForm = MyDLL.CreateInstance("MyDLL.MyForm") MyForm.Show()
This code works fine, but, I want to prevent that if the form is loaded, doesn't load other instance, How can I do it?
\\\
Private m_MyForm As Form
..
..
..
If MyForm Is Nothing Then
MyForm = MyDll.CreateInstance(...)
Else
MsgBox("Form already instantiated!")
End If
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Herfried thanks for your great patience,
When close MyForm and then I want to load it again, it's already
instantiated and doesn't show, in some place of my code when from is closing
I must to set MyForm = nothing, but where?
Thanks
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> escribió en el mensaje
news:e8****************@TK2MSFTNGP09.phx.gbl... "Juande" <a@b.com> schrieb: Sorry, but I've got another problem, as you know, I load at runtime my dll, this dll contains a class called MyForm, example code on a click button event;
Dim MyDLL As [Assembly] MyDLL = System.Reflection.Assembly.LoadFrom("MyDLL.dll") Dim MyForm As Form MyForm = MyDLL.CreateInstance("MyDLL.MyForm") MyForm.Show()
This code works fine, but, I want to prevent that if the form is loaded, doesn't load other instance, How can I do it?
\\\ Private m_MyForm As Form . . . If MyForm Is Nothing Then MyForm = MyDll.CreateInstance(...) Else MsgBox("Form already instantiated!") End If ///
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
"Juande" <a@b.com> schrieb: When close MyForm and then I want to load it again, it's already instantiated and doesn't show, in some place of my code when from is closing I must to set MyForm = nothing, but where?
You may want to add a handler to the form's 'Closed' event using
'AddHandler' and set the variable to 'Nothing' there.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Hello Herfried,
Finally I got to dispose the instance of MyForm with AddHandler and
RemoveHandler, thanks to you.
But, every time that I do something about this, problems come to me. The
next question is; How can I access to the methods, functions or variables
declared into 'MyForm'.
One more time, many thanks
"Juande" <a@b.com> schrieb: Finally I got to dispose the instance of MyForm with AddHandler and RemoveHandler, thanks to you. But, every time that I do something about this, problems come to me. The next question is; How can I access to the methods, functions or variables declared into 'MyForm'.
Direct access to the members would require type information to be available
at compile-time, for example, an interface which defines the methods the
class implements or a design-time reference. Otherwise you'll have to use
reflection (namespace 'System.Reflection') or 'CallByName' to call methods
on the objects.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: filip stas |
last post by:
How do i add references during runtime?
|
by: MLH |
last post by:
A97 topic.
Opening a new thread related to some other discussions -
> > > just to make sure < < <
that installing an OCX or adding an mdb using references other than
the BASIC-3 that I use...
|
by: Lisa Jones |
last post by:
Hi
I am trying to add web reference to my code to use web services . (I am using VS 2003) so I go to add references/ select web reference. After selecting the right web service from my local...
|
by: Craig Lister |
last post by:
Newish to c# - Coming from Delphi. I'd like to add 255 checkboxes to a
screen at runtime, and name then cb1, cb2... cb255
The code below does not work, but, how can I get this to work?
public...
|
by: Praveen Ramesh |
last post by:
Hi,
Is there any way to add the @Assembly reference to the aspx files
programmatically from inside a custom control (when it gets dropped on to
the page from the toolbox)?
I have a custom...
| |
by: MIGUEL |
last post by:
Hi all,
I'm quite lost with how adding web references to a project creates proxy
classes.
I've developed a web service with two classes inside and that contains three
references to three...
|
by: _DS |
last post by:
The two obvious methods for ref'ing assemblies are:
Add a reference and 'Browse' for the actual DLL
OR
Add existing project to the solution, then add a ref to 'Project'.
1: I'd like to...
|
by: Michael Russell |
last post by:
Hi all,
Using C#, I've created a simple wrapper class for using Excel. I have
Office Pro 2003 installed on my devel machine. The wrapper class works
great, reading and writing to/from Excel. ...
|
by: doina |
last post by:
Hello,
Can I have runtime polymorphism using references. I knew that runtime
polymorphism could be obtained only by pointers, but now I have tried
this in Visual C++ 8.0:
#include <iostream>...
|
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...
|
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...
| |
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...
|
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,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
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...
|
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 ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |