Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JS Can't read my VB Array??

Status
Not open for further replies.

ftpdoo

Programmer
Aug 9, 2001
202
GB

Im returning an array from VB6 as a array of string:

Public Function getStatusUpdate As String()

But in my Java Script its being picked up as three square boxes!?

function GetStatusUpdate(workOrderNumber) {
update = FDCSScriptPlayer1.GetStatusUpdate(workOrderNumber);
x = ['one','two','three'];
alert(update);
var y = update[0];
alert(y);
}

Any idea how i can view this VB array in JavaScript??

Thanks,
Jonathan
 
most likely VB arrays are not the same as javascript arrays. have your VB func return some delimited string, then js can create an array.

return something like
"foo,bar,baz"
or
"foo~bar~baz"

then javascript can split it:
var myString = "foo~bar~baz";
var myArray = myString.split("~");

-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
i like your sleeves...they're real big
 
Should i not be able to view the array using:

alert(update[0]);


Instead i get a square?
 
If it is
[tt]FDCSScriptPlayer1.GetStatusUpdate(workOrderNumber);
[/tt]
which returns a vbarray and you want to access update, try this?
[tt]
var x=new VBArray(FDCSScriptPlayer1.GetStatusUpdate(workOrderNumber));
var update=x.toArray();
[/tt]

 

Thanks Tsuji,

But this gives me the following error: ??

An exception of type 'Microsoft JScript runtime error: VBArray expected' was not handled.

Any other ideas?
 
Check out in the vb environment vartype(...) see if it gives 8204, array of variants or something else?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top