Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / December 2004

Tip: Looking for answers? Try searching our database.

How to pass parameter - driving me crazy?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeff - 04 Dec 2004 17:45 GMT
The example to make the dll call work in vb is like this:

sAnswer = oleOldObject.Request(Array("CODEZ", "LARRY", "JONES", "00"))

The interop has described the method this way:

public abstract new System.Object Request ( System.Object sMessages )

It shows up in code as "Request(ref object)"

I've tried to pass an array everry which way but loose in C#:

Array arrInput = null;
arrInput.SetValue("CODEZ", 0);
arrInput.SetValue("LARRY", 1);
arrInput.SetValue("JONES", 2);
arrInput.SetValue("00", 3);

sAnswer = oleOldObject.Request(ref (object)arrInput);

Produces error:

"A ref or out argument must be an lvalue"

OR

string[] arrInput = {"CODEZ", "LARRY", "JONES", "00};

sAnswer = oleOldObject.Request(ref arrInput);

Produces errors:

1) The best overloaded method match for Object1.oleOldObject.Request(ref
object)' has some invalid arguments.
2) Argument '1': cannot convert from 'ref string[]' to 'ref object'
Mattias Sj?gren - 05 Dec 2004 12:03 GMT
Jeff,

Try this:

object arrInput = new string[] {"CODEZ", "LARRY", "JONES", "00"};
sAnswer = oleOldObject.Request(ref arrInput);

Mattias

Signature

Mattias Sjögren [MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Jeff - 11 Dec 2004 00:26 GMT
That worked fine, thanks to you, Merry Xmas, Happy Hanukah, etc.

Signature

Jeff

> Jeff,
>
[quoted text clipped - 4 lines]
>
> Mattias
Suri - 13 Dec 2004 14:34 GMT
If the retuen value is also an array, they how would I go about. I have tried with the
 object sAnswer = string[]

Doesn't workout. Eve
 object sAnswer = string[2]

and Message.Show(sAnswer[0]); fails. I am interested in getting the output element for further parsing

Any help is appreciated. Thanks in advanc

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.