Hi folks. I am calling from Navision out to a program that I wrote in VB.NET. The VB program takes 2 parameters. The VB code that accepts the parameters is as follows:
Dim MyStartupArguments()
MyStartupArguments = System.Environment.GetCommandLineArgs
When I call it from Start > Run with the following syntax it works perfectly.
e:\Costing_VBdotNET3\Costing.exe SHEET 10-3025
When the VB app starts in this way, the MyStartupArguments array looks like this:
MyStartupArguments(0) = 'e:\Costing_VBdotNET3\Costing.exe'
MyStartupArguments(1) = 'SHEET'
MyStartupArguments(2) = '10-3025'
However I am having trouble getting it to run from Navision with this syntax:
TypeVar := 'SHEET' ;
Item := '10-3025' ;
SHELL('e:\Costing_VBdotNET3\Costing.exe', TypeVar, Item);
I keep getting a VB error telling me that "index is outside the bounds of the array" and referencing the line "MyStartupArguments = System.Environment.GetCommandLineArgs." Since the MyStartupArguments array is not of any predefined length, how is this happening? I can only think that Navision presents its parameters differently... in columns rather than rows? Any ideas?
Thanks,
Chandler
Comments
1) The " around the variables makes sure the parameter is send to the exe as 1 parameter in case it has characters that would divide it.
2) I remember there was some bug with the SHELL of an older version of Navision, but I don't remember until which version. But 3.10 is in it.
You can also use this instead of SHELL : http://www.mibuso.com/forum/viewtopic.php?t=12417
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Chandler