Search:
Namespaces
Discussions
.NET v1.1
Feedback
Getting values from a COM object through ByRef parameters.
Messages
Related Types
This message was discovered on
microsoft.public.dotnet.languages.vb.upgrade
.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...
Tim Tyannikov
I asked this question in C# groups but did not get any response back.
I decided to try my luck here. My problem is that I can't get values
from a COM object through ByRef parameters using InvokeMember method.
Here is a very simple example in VB6 + C#:
I have a test class called RefTest in TestByRef project. The class
has only one method:
Public Sub Sub1(ByRef x As String)
x = "asdf"
End Sub
In my test C# project I have:
Type
t =
Type
.GetTypeFromProgID("TestByRef.RefTest", true);
object test =
Activator
.CreateInstance(t);
object [] args = new object[1]{null};
test.GetType()
.InvokeMember("Sub1"
, System.Reflection.
BindingFlags
.InvokeMethod
,null,test, args);
txtTestMethodResult.Text = args[0].ToString();
This code does not take me anywhere. The value of args[0] is always
null; not "asdf" as I expect.
Can somebody please tell me what is it that I am doing wrong?
Your response is greatly appreciated,
Tim.
Reply to this message...
Patrick Steele [MVP] (VIP)
In article <
Click here to reveal e-mail address
>,
Click here to reveal e-mail address
says...
[Original message clipped]
See this article:
http://www.google.com/groups?selm=BC4gFoXoCHA.1928
%40cpmsftngxa06
--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Reply to this message...
System.Activator
System.Reflection.BindingFlags
System.Type
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com