473,394 Members | 1,828 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,394 software developers and data experts.

System.Type.InvokeMember()

Hi All,

I'm invoking Type.InvokeMember() on a COM class (via COMInterop) through
a generalized interface. However, each specialized instance (of the
COMInterop generic interface) requires slightly different arguments for
which I dynamically create the object[] arguments and it all works nicely.

Problem is, in some instances, I have methods which require certain
arguments to be referenced (ref string x,...etc). I'm not sure how I can
specify that aspect in the object[] arguments of Type.InvokeMember(...)

Is it possible? How?

Thanks in advance,

Rein
Nov 16 '05 #1
1 6113
Rein,

You have to call the version of InvokeMember which takes an array of
ParameterModifier instances. You will have to set the value on the
parameters you want to be able to be changed to true where they are to be
modified.

Here is a link to a thread that I found which has an example of how to
use it (watch for line wrap):

http://www.dotnetmonster.com/Uwe/For...n-InvokeMember

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Rein Petersen" <rm********@hotmail.com> wrote in message
news:eh**************@TK2MSFTNGP10.phx.gbl...
Hi All,

I'm invoking Type.InvokeMember() on a COM class (via COMInterop) through a
generalized interface. However, each specialized instance (of the
COMInterop generic interface) requires slightly different arguments for
which I dynamically create the object[] arguments and it all works nicely.

Problem is, in some instances, I have methods which require certain
arguments to be referenced (ref string x,...etc). I'm not sure how I can
specify that aspect in the object[] arguments of Type.InvokeMember(...)

Is it possible? How?

Thanks in advance,

Rein

Nov 16 '05 #2

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

Similar topics

1
by: mike | last post by:
hello, Using Type.InvokeMember to call a method of a class,Which method has byref parameter,It seems that there is no way to return the changed value of that byref parameter by the method of...
10
by: Dave Leach | last post by:
I am writing a Windows MDI application in C#. I would like to cast an object to a specific type. I know that the object is of a compatible type. The code below shows what I would like to do, but...
0
by: Gemma M | last post by:
Hi, I have a C# program (code fragment below), which runs forever, processing incoming jobs. Part of this program launches a COM object. However, after a while I get : ...
0
by: Pat Ireland | last post by:
To use the InvokeMember for calling a method in a dynamically loaded class requires that any arguments to the method must be past in an object . However, when I try to perform a pass by reference...
1
by: JS | last post by:
In my project, I am setting Options Strict on. In one place, I have generic code to set values in my objects using a configuration file, code which is trying to set properties of my classes using...
2
by: Ryan | last post by:
Hi, I receive an access denied error (see below) when attempting to send an email with BodyFormat=MailFormat.Html from an asp.net page. Exactly the same code works fine in a console...
2
by: ChrisA | last post by:
I'm sending email from my ASP.NET 1.1 app, and it works fine providing the BodyFormat of the System.Web.Mail.MailMessage is set to Text. If I change to Html format, it breaks. Here's the code: ...
4
by: Rob Blackmore | last post by:
Hi, Can anyone advise how to call a private constructor using reflection? I currently get the above error which is rectified by changing the New() to Public from Friend but I ideally wish to...
4
by: adiel_g | last post by:
I am trying to set a value on a structure object dynamically using InvokeMember. After I call InvokeMember, the value on the Admin flag does not get updated. Here is the following sample code to...
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:
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
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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 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.