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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Do You Pass A Array Through A Write Command to another sub

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I can't pass an array through using a write command to another sub.Probily because of the syntax such a method requires. Heres my prob

array(4) = 1000
document.write(&quot;<td onclick=Show(array(4))>Test</td>&quot;)

Sub Show(msg)
msgbox(msg)
End Sub
A TYPE MISMATCH ERROR OCCURS.
WHATS THE CORRECT SYNTAX
 
Hello,
array is a keyword.
Name your variable with another name.

It is a function in VBScript that returns a Variant containing an array.

Array(arglist)

The required arglist argument is a comma-delimited list of values that are assigned to the elements of an array contained with the Variant. If no arguments are specified, an array of zero length is created.

Example:

Dim A
A = Array(10,20,30)
B = A(2) ' B is now 30.
 
actually I believe his problem is in trying to convert a var type int, which is what 1000 is, to string, try:

array(4) = 1000
document.write(&quot;<td onclick=Show(&quot;+cstr(array(4))+&quot;)>Test</td>&quot;)

Sub Show(msg)
msgbox(msg)
End Sub

all should be well
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top