Hi all,
I'm having some problems again. I've created an ActiveX-EXE project in VB6 and use it in navision for automation.
I've declared public events in the class so navision could see when something was moved, ....
Public Event OnMove(orderNo As String, truckcode As String)
In a function I then do:
RaiseEvent OnMove("Test", "Test")
So, when I add the automation variable in navision and set the propperties to With events: Yes. I see the events. But when I enter code into it like a MESSAGE('test'); for instance, nothing happens
Can anyone help me out here?
Thanks
Comments
In navision I do:
1. CREATE(AutomationObject);
2. Set the properties to withevents
3. Inside the trigger in C/AL code i write: MESSAGE('Test');
4. Run the AutomationObject
To me it seems you are doing nothing wrong.
But in my experience sometimes triggers are not executed and i think it has something to do with how busy your system is. So try to do a test by stripping down as much as possible.
Ask these questions:
- Is navision busy at the moment the event is triggered?
- Is you VB DLL busy when the event is triggered?
If yes to any of those this may be a problem (see it as a navision bug then)
I don't know if this can cause behavoir that stops the trigger from execution but this is what i suspect to be a possible cause.
I once made a custom raiseevent that temporary stores the event in a global var of the VB program and when execution was suspended i actually raised the event. This seemed to work better.
Also maybe it helps playing arround with defining the event arguments as ByVal or ByRef. Maybe this makes a difference as well.
Though i do not know if any of these possible sollutions will work.
Good luck.
RIS Plus, LLC
Setting the codeunit's properties to "Single Instance: Yes" did the trick