Home All Groups Group Topic Archive Search About

"Binding" an interface to an object definition in vb.net??

Author
26 Nov 2007 11:11 PM
barcrofter
Im still confused with interfaces for COM objects.  I have a Lotus
word processor that I'm trying to automate via vb.net.  The exe comes
with an interface that I can add as a reference .. but..  I cannot
seem to generate an instance of it because (error message) the .tlb
file only provides the interface.  Thus I use CreateObject("etc") to
define an object that picks up the exe.

Question: is there any way or trick for binding the object to the
interface so that I can debug the program more speedily and access its
methods more easily??

Author
27 Nov 2007 6:12 AM
Mattias Sjögren
>Question: is there any way or trick for binding the object to the
>interface so that I can debug the program more speedily and access its
>methods more easily??

Not sure what you mean by binding exactly, but it sounds like a
regular cast should do it.

Dim x As IFoo = CType(CreateObject(...), IFoo)


Mattias

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Author
29 Nov 2007 10:29 AM
barcrofter
On Nov 26, 11:12 pm, Mattias Sjögren <mattias.dont.want.s***@mvps.org>
wrote:
Show quoteHide quote
> >Question: is there any way or trick for binding the object to the
> >interface so that I can debug the program more speedily and access its
> >methods more easily??
>
> Not sure what you mean by binding exactly, but it sounds like a
> regular cast should do it.
>
> Dim x As IFoo = CType(CreateObject(...), IFoo)
>
> Mattias
>
> --
> Mattias Sjögren [C# MVP]  mattias @ mvps.orghttp://www.msjogren.net/dotnet/|http://www.dotnetinterop.com
> Please reply only to the newsgroup.

That did it -- thanx