COM Interop problem 
Author Message
 COM Interop problem

I have a VB.NET object that raises an event.  I run RegAsm just fine and can
create the object in VB6 and call the properties and methods on it.  The
problem I'm having is that the events exposed by the VB.NET class are not
visible.  There are the Add_ & Remove_ mothods there though.  Am I doing
anything wrong or is this a bug?

--
Aaron A. Anderson, MCSD
Software Architect
Farm Credit Bank of Texas
---
Will more animals die during, a) oil drilling in the Alaskan
Wilderness Preserve, or b) production of footwear for the
protesters? -Scott Adams



Sun, 23 Nov 2003 23:33:24 GMT  
 COM Interop problem


Quote:
> I have a VB.NET object that raises an event.  I run RegAsm just fine and can
> create the object in VB6 and call the properties and methods on it.  The
> problem I'm having is that the events exposed by the VB.NET class are not
> visible.  There are the Add_ & Remove_ mothods there though.  Am I doing
> anything wrong or is this a bug?

I believe the issue is the VB6 needs an IDispatch interface.  See:

http://discuss.develop.com/archives/wa.exe?A2=ind0104C&L=DOTNET&P=R9567

for details.

--
Patrick Steele

Lead Software Architect
Image Process Design



Mon, 24 Nov 2003 01:08:38 GMT  
 COM Interop problem
So what am I doing wrong?  here's the code

Imports System.Runtime.InteropServices

Namespace VBEVENTSLib

    Public Delegate Sub MyEventDelegate(ByVal index As Integer)

    Public Interface
<InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)> IVBEvents
        Sub MyEvent(ByVal index As Integer)
    End Interface

    Public Class <ComSourceInterfaces("VBEVENTSLib.IVBEvents")> VBEvents

        Public Event MyEvent(ByVal index As Integer)
        Public Sub OnMyEvent(ByVal index As Integer) 'Call this method from
the VB6 client.
            Call MsgBox("got to here")
            RaiseEvent MyEvent(index)
            Call MsgBox("never makes it here")
        End Sub
    End Class

End Namespace


Quote:


> > I have a VB.NET object that raises an event.  I run RegAsm just fine and
can
> > create the object in VB6 and call the properties and methods on it.  The
> > problem I'm having is that the events exposed by the VB.NET class are
not
> > visible.  There are the Add_ & Remove_ mothods there though.  Am I doing
> > anything wrong or is this a bug?

> I believe the issue is the VB6 needs an IDispatch interface.  See:

> http://discuss.develop.com/archives/wa.exe?A2=ind0104C&L=DOTNET&P=R9567

> for details.

> --
> Patrick Steele

> Lead Software Architect
> Image Process Design



Mon, 24 Nov 2003 03:09:30 GMT  
 COM Interop problem


Quote:
> So what am I doing wrong?  here's the code

I've got some code on my .NET machine at home that used this attribute.  
I'll try and send it up tonight.

--
Patrick Steele

Lead Software Architect
Image Process Design



Mon, 24 Nov 2003 04:20:33 GMT  
 COM Interop problem
Thanks! Figured it all out late last night.  I've not got a .NET component
that's very close to being 100% compatible with my VB6 version of the same
component.


Quote:


> > So what am I doing wrong?  here's the code

> I've got some code on my .NET machine at home that used this attribute.
> I'll try and send it up tonight.

> --
> Patrick Steele

> Lead Software Architect
> Image Process Design



Mon, 24 Nov 2003 21:39:15 GMT  
 COM Interop problem


Quote:
> Thanks! Figured it all out late last night.  I've not got a .NET component
> that's very close to being 100% compatible with my VB6 version of the same
> component.

Well, this might help.  I didn't have an Interface like you did, but
here's how I defined an event in VB.NET that showed up like a regular
event in VB6 (none of the "add_xxx/remove_xxx" stuff exposed):

Public Event
        <InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)>
        Complete(ByVal Message As String)

(I broke the lines up for readability.)

--
Patrick Steele

Lead Software Architect
Image Process Design



Mon, 24 Nov 2003 23:55:23 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Com interop problem with Framework 1.1

2. Com/Interop problem

3. COM interop problems

4. COM Interop problem

5. COM Interop problem

6. Problem passing VB COM+ ASP Request object to .NET component System.Web.HTTPRequest through COM interop

7. COM interop or vbscript problem

8. COM interop or VBScript problem

9. Automation error referencing .net dll from com (com interop)

10. COM Interop question

11. Strong named COM Interop

12. ParamArray and COM Interop

 

 
Powered by phpBB® Forum Software