Thanks for reading,
I've got the following function:
Private allFlags As BindingFlags = BindingFlags.Public Or
BindingFlags.NonPublic Or _
BindingFlags.Static Or _
BindingFlags.Instance
Public Shared Function StartAUT(ByVal applicationPath As String, ByVal
typeName As String) As Object
Dim aTtype As Type =
Assembly.LoadFrom(applicationPath).GetType(typeNam e)
Dim obj As Object = Activator.CreateInstance(type1)
aType.GetMethod("Show", allFlags).Invoke(obj, Nothing)
Return obj
End Function
When I give as applicationPath a simple form (afrom.exe) then there
are by default two show-methods
1. show()
2. show(IWin32Window)
The program is giving an execption and complaining that he found two
methods.
I want to invoke the first one, that without parameters.
How can I do that, what do I wrong?
They already told me that I can use follow code to have the same
result:
------
For Each m As MethodInfo In typeUT.GetMethods("Show", allFlags)
If m.GetParameters().Length = 0 Then
mi = m
Exit For
End If
Next
------
I think that the problem is that I don't give the correct "empty"
parameter, and would like to know the sollution in VB.
I found the following C# code with do correctly, but I need it in VB.
C#
------
Assembly asm = Assembly.LoadFrom(applicationPath);
Type typeUT = asm.GetType(typeName);
object obj = Activator.CreateInstance(typeUT);
MethodInfo mi = typeUT.GetMethod("Show", allFlags);
mi.Invoke(obj, null);
Return obj;
------
Thanks for helping. 2 1118
here's the C# block in VB.net maybe this will get you started
Dim asm As Assembly = Assembly.LoadFrom(applicationPath)
Dim typeUT As Type = asm.GetType(typeName)
Dim obj As object = Activator.CreateInstance(typeUT)
Dim mi as MethodInfo = typeUT.GetMethod("Show", allFlags)
mi.Invoke(obj, Nothing)
Return obj
"De Roeck" wrote:
Thanks for reading,
I've got the following function:
Private allFlags As BindingFlags = BindingFlags.Public Or
BindingFlags.NonPublic Or _
BindingFlags.Static Or _
BindingFlags.Instance
Public Shared Function StartAUT(ByVal applicationPath As String, ByVal
typeName As String) As Object
Dim aTtype As Type =
Assembly.LoadFrom(applicationPath).GetType(typeNam e)
Dim obj As Object = Activator.CreateInstance(type1)
aType.GetMethod("Show", allFlags).Invoke(obj, Nothing)
Return obj
End Function
When I give as applicationPath a simple form (afrom.exe) then there
are by default two show-methods
1. show()
2. show(IWin32Window)
The program is giving an execption and complaining that he found two
methods.
I want to invoke the first one, that without parameters.
How can I do that, what do I wrong?
They already told me that I can use follow code to have the same
result:
------
For Each m As MethodInfo In typeUT.GetMethods("Show", allFlags)
If m.GetParameters().Length = 0 Then
mi = m
Exit For
End If
Next
------
I think that the problem is that I don't give the correct "empty"
parameter, and would like to know the sollution in VB.
I found the following C# code with do correctly, but I need it in VB.
C#
------
Assembly asm = Assembly.LoadFrom(applicationPath);
Type typeUT = asm.GetType(typeName);
object obj = Activator.CreateInstance(typeUT);
MethodInfo mi = typeUT.GetMethod("Show", allFlags);
mi.Invoke(obj, null);
Return obj;
------
Thanks for helping.
WerD, thanks for your reply..
I've used the code you've provided, but then I received an
AmbiguousMatchException.
So you do not take the method without parameters (and do not know with
one to take)
So I'm still here with the problem.
On Tue, 31 Oct 2006 21:00:01 -0800, werD
<we**@discussions.microsoft.comwrote:
>here's the C# block in VB.net maybe this will get you started
Dim asm As Assembly = Assembly.LoadFrom(applicationPath) Dim typeUT As Type = asm.GetType(typeName) Dim obj As object = Activator.CreateInstance(typeUT) Dim mi as MethodInfo = typeUT.GetMethod("Show", allFlags) mi.Invoke(obj, Nothing) Return obj
"De Roeck" wrote:
>Thanks for reading,
I've got the following function:
Private allFlags As BindingFlags = BindingFlags.Public Or BindingFlags.NonPublic Or _ BindingFlags.Static Or _ BindingFlags.Instance
Public Shared Function StartAUT(ByVal applicationPath As String, ByVal typeName As String) As Object Dim aTtype As Type = Assembly.LoadFrom(applicationPath).GetType(typeNa me) Dim obj As Object = Activator.CreateInstance(type1) aType.GetMethod("Show", allFlags).Invoke(obj, Nothing) Return obj End Function
When I give as applicationPath a simple form (afrom.exe) then there are by default two show-methods
1. show() 2. show(IWin32Window)
The program is giving an execption and complaining that he found two methods.
I want to invoke the first one, that without parameters. How can I do that, what do I wrong?
They already told me that I can use follow code to have the same result:
------ For Each m As MethodInfo In typeUT.GetMethods("Show", allFlags) If m.GetParameters().Length = 0 Then mi = m Exit For End If Next ------
I think that the problem is that I don't give the correct "empty" parameter, and would like to know the sollution in VB.
I found the following C# code with do correctly, but I need it in VB.
C# ------ Assembly asm = Assembly.LoadFrom(applicationPath); Type typeUT = asm.GetType(typeName); object obj = Activator.CreateInstance(typeUT); MethodInfo mi = typeUT.GetMethod("Show", allFlags); mi.Invoke(obj, null); Return obj; ------
Thanks for helping. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: mike420 |
last post by:
In the context of LATEX, some Pythonista asked what the big
successes of Lisp were. I think there were at least three *big*
successes.
a. orbitz.com web site uses Lisp for algorithms, etc.
b....
|
by: VK |
last post by:
Hi, all!
In my programm i have to insert a variable from class 2 to class 1 and I
get error NameError: global name 'd' is not defined. How do I get access
to d.entry.insert() method of class 1
...
|
by: Franco, Gustavo |
last post by:
Hi, I have a question, and please I need a answer.
How can I finalize a thread running with Application.Run (I need the message
loop!!!) without call Thread.Abort?.
I want to call...
|
by: pamelafluente |
last post by:
Hi, I am invoking Firefox, and for testing IE, from my VB program. The
instruction are of this kind:
Process.Start("IExplore.exe", Parameter)
Process.Start("Firefox.exe", Parameter)
where...
|
by: andreas |
last post by:
Bill, what are you doing?
I see the methode count in vb.net and in vb.net express but not in vb.net
2003
int = treeview.nodes.count
Int = treeview1.nodes(i).nodes.count
|
by: milmus tender |
last post by:
Hi,
we have some customized EditorParts, which inherits from a DefaultEditor.
This DefaultEditorPart inherits from the standard EditorPart-Class. In this
DefaultEditorPart we override the...
|
by: Thomas Kowalski |
last post by:
Hi everyone,
recently I have trouble to pass an array (unsigned char color) to a
methode by reference and collect the return value by reference.
I wanted something like:
unsigned char&...
|
by: bchaib |
last post by:
Good time everyone here
When I created an account on this site I got this url:
http://www.thescripts.com/forum/register.php?do=register
So now I have a question about ?do=register and what does...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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: 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...
|
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: 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...
| |