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

Type mismatch on passing ByteArray to activex component

Status
Not open for further replies.

ktcute

Programmer
Jun 12, 2003
2
GB
I have an activeX component written in visual basic, which uploads a file in the form of a bytearray, passing the result to a vbscript variable. This value is then passed to a further activeX component function, that requires a variant. On execution the web page displays a "Type Mismatch" error.

I've checked the data type of the variable holding the file contents, and it is a bytearray, as the upload component should return. It seems that although all variables are "variant" in vbscript, the vb activex component is receiving the parameter in the function call as a bytearray.

Can anyone tell me if this is because vbscript handles arrays differently to other data types, and is there some way I can ensure that what the second activex control receives is of the variant type?

Thanks in advance
 
It would have helped if you had posted some code but since I read minds, I'll bet that you defined your array thusly.

Dim aryByt()

That is an array of Variants instead of a Variant containing an array.

Try
Dim aryByt ' Variant
Redim aryByt(WhatweverUbondSuitsyou) ' Put array "inside" the Variant.

There is a difference between an array of Variants and a Variant that cotains an array.

In the ActiveX, define the parameter that receives the Variant without parentheses.

Public Sub ReceiveVariantWith Array(ary as Variant)
debug.print ary(0)
End Sub

Forms/Controls Resizing/Tabbing Control
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top