HOW TO:Cre. VB6 program with property method event

Hello All, I would like to create a vb program so that I can capture it’s events. I have created an VB 6 OCX with events. With in my codeunit I have a automation variable to that event, Properties is set to withevent=yes but I don’t get the events coming into my code unit. What am I missing? I have NAS working with the NavisionTimer:: events. Look forward to your replays and inputs. Regards

How can you register your OCX as automation server ? As far as I remember only automation server events are supported in Navision. Even though that creating an OCX with events is much easier than creating an automation server which is able to fire events which can be received by Navision. As far as I figured out the events need to use the IDispatch interface somehow. But I was not able to create such an automation server yet. I tried with VC++.

Hi, you have to write an ActiveX DLL in VB6 to catch events in Navision. Have a look at the Gant VB Project on the MBS 4.00 CD, in this Project you can see how Events must be programmed. regards Mathes

Thx for your replys Mathes and Thomas. I needed to create a VB 6 ActiveX DLL as Mathes said. Then I created a class called clsName. Then I created one property, method and one little event. (Thx VBJoe from TREME VB Talk for his example) 'In a class called clsName: Option Explicit 'PRIVATE VARIABLES: Private mvarFullName As String 'EVENT DECLARATIONS: Public Event NameChanged(NewValue As String) 'PROPERTY DECLARATIONS: Public Property Get FullName() As String FullName = mvarFullName End Property Public Property Let FullName(vData As String) mvarFullName = vData RaiseEvent NameChanged(mvarFullName) End Property 'PUBLIC METHOD: Public Sub SetName(FirstName As String, LastName As String) mvarFullName = FirstName & " " & LastName RaiseEvent NameChanged(mvarFullName) End Sub Then in my codeunit I added a varible called myevents, type=automation and pointed this to my newly created VB dll. set the propertie for myevents varible withevents=yes. “myevents::NameChanged”(NewValue) MESSAGE(myevents.FullName); OnRun() IF ISCLEAR(myevents) THEN CREATE(myevents); strFirstName := ‘Graham’; strSecondName:= ‘Spencer’; myevents.SetName(strFirstName,strSecondName); codeunit with events method and proprty. Very Nice