COM interop help

E

edmitchell

I'm getting an error when I pass "User" in "report.HasBeenAccesedBy(ref
User,ref UserN);" I have created the iL to see if there is something
incorrect.

..method public hidebysig newslot abstract virtual
instance bool HasBeenAccesedBy([in][out] class LDD.User&
marshal( interface) aUser,
[in][out][opt] string&
marshal( bstr) aUserID) runtime managed internalcall

and is failing in the marshal(interface). but not sure what else to
try. Any help would be appreciated.




LDD.UserRepositoryClass PRC;
PRC = new PRDS_ORAL.UserRepositoryClass();


LDD.UserClass User;
User = (LDD.UserClass)PRC.UserByID(ref UsrID);


LDD.ReportCollectionClass reports;
reports = (LDD.ReportCollectionClass)User.UnaccesedReports(ref UserN);


for ( int count = 1;count<=reports.Count;count++)
{

LDD.ReportClass report;
report = (LDD.ReportClass)reports.get_ItemByIndex(ref count);


report.HasBeenAccesedBy(ref User,ref UserN);
 
N

Nicholas Paldino [.NET/C# MVP]

Ed,

If you could tell what the error is, it would help.

I believe that it has to do with your declaration of the User variable.
It should be of type LDD.User (the name of the interface on the class, not
the implementation name). Or, if it is a VB COM dll, then LDD._User.

The UserClass is just the implementation, not the interface, which is
really what is being accessed in COM.

Hope this helps.
 
E

edmitchell

Sorry the error I get is:

The best overloaded method match for LDD.ReportClass.HasbeenAccedBy(ref
LDD.User, ref string) has someinvalid arguments.
 
N

Nicholas Paldino [.NET/C# MVP]

Ed,

Then what I said would be right. If HasbeenAccedBy is looking for a
LDD.User and you are passing in LDD.UserClass, it won't work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top