I try to use method ShowColor from Common Dialog.
Afterwards, I try to get the selected Color with the property Color which is a OLE_Color variable type.
But how can we declare an OLE_COLOR variable in Navision ?
I think that it is problem of using OCX on RTC. Do not forget that the automation is created on service tier by default (I am not sure if it is true for OCX too, but for Automation it is true, but you can change it by parameter of CREATE, but this is not used for OCX).
Answers
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Variables:
VariantVal : Variant
Script: Automation 'Microsoft Script Control 1.0'.ScriptControl"
ColorDialog: OCX 'Microsoft Common Dialog Control, version 6.0'"
ColorValue : Integer
and code:
CREATE(Script);
Script.Language := 'VBScript';
VariantVal := Script.Eval(ColorDialog.Color);
ColorValue := VariantVal;
It was so easy....
Fingers in the noses !
"Unable to convert from Microsoft.Dynamics.Nav.Runtime.NavAutomation to System.String."
This is the code that gives the error:
liColor := lautConvColorToInt.Eval(locxCommonDialogControl.Color);
I tried to replace the liColor (integer) with a variant, and this works, but then I can't convert the variant to an integer
Thx,
Andy
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Jan Hoek
Product Developer
Mprise Products B.V.
The commonDialog has a .NET wrapper.
Instead of using VB, you write C# like .NET code.