I have a created a Codeunit that calls an AutomationVar with the property "WithEvents" set to yes.
The Code is pretty simple:
"
IF ISCLEAR(AutomationVar) then
CREATE(AutomationVar);
AutomationVar.StartTest(Parameters1-5).
"
When i Run this Codeunit Navision crashes with the message
"Microsoft Business Solutions-Navision has encountered a problem and needs to close"
The strange part i that I can create a Form that OnOpenForm calls the codeunit with no problems whatsoever, and I can also insert a CommandButton on the Form where I call the codeunit. Again with no errors.
Does anyone know why I can't runl the Codeunit directly?
0
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
If you want to do something with the events you need a singleinstance codeunit I think. Otherwise the events make no sence.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
The purpose of the Autmation is to validate som technical informations speciefied on the Sales Lines, to determine if the configuration of an Item makes sense.
When running the Codeunit it should be possible for a person so see somme graphs created in sanother program, and after the validation has completed, navision should retrieve a message that either confirms or abort the configuration.
But they might have changed it. I do not have experience after 3.70 with this.
<edit>
Mark... just saw that you suggested this... I don't even have my coffee yet guys, go easy on me, it's early in the morning :shock:
</edit>
RIS Plus, LLC
This way the object is not destroyed yet,
You can make some function that returns the value you want to have
After that you can destroy the object by using CLEAR()
Unfortunatly I don't have access to this code anymore.