469,306 Members | 2,512 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,306 developers. It's quick & easy.

Write Byte Array Values

Hi! I am returning a byte array from a function and wish to print out
the values of the array. However, I get

Microsoft VBScript runtime error '800a000d'
Type mismatch

Here is the gist of the code:

<%
Dim obj
Dim myBArray ' Array of Byte
Dim i

Set obj = Server.CreateObject("My.Function")

' Returns an array of byte
myBArray = obj.CreateByteArray("ABCDEF")

If IsArray(myBArray) Then
Response.Write "LBound(myBArray): " & LBound(myBArray)
Response.Write "<br>"
Response.Write "UBound(myBArray): " & UBound(myBArray)
Response.Write "-----------------<br>"
For i = LBound(myBArray) To UBound(myBArray)
Response.Write myBArray(i)
Next
Else
Response.Write "myBArray is not an array"
End If

Set obj = Nothing
%>
myBArray is an Array, and returns valid Lower and Upper Bounds, however
the code blows up on the Response.Write myBArray(i). Any ideas how to
fix this?
TIA,

DaveS

*** Sent via Developersdex http://www.developersdex.com ***
Jan 14 '06 #1
3 10928
Try:-

Response.Write CStr(myBArray(i))
"DaveS" wrote:
Hi! I am returning a byte array from a function and wish to print out
the values of the array. However, I get

Microsoft VBScript runtime error '800a000d'
Type mismatch

Here is the gist of the code:

<%
Dim obj
Dim myBArray ' Array of Byte
Dim i

Set obj = Server.CreateObject("My.Function")

' Returns an array of byte
myBArray = obj.CreateByteArray("ABCDEF")

If IsArray(myBArray) Then
Response.Write "LBound(myBArray): " & LBound(myBArray)
Response.Write "<br>"
Response.Write "UBound(myBArray): " & UBound(myBArray)
Response.Write "-----------------<br>"
For i = LBound(myBArray) To UBound(myBArray)
Response.Write myBArray(i)
Next
Else
Response.Write "myBArray is not an array"
End If

Set obj = Nothing
%>
myBArray is an Array, and returns valid Lower and Upper Bounds, however
the code blows up on the Response.Write myBArray(i). Any ideas how to
fix this?
TIA,

DaveS

*** Sent via Developersdex http://www.developersdex.com ***

Jan 14 '06 #2
Thanks for the help. The line still blows up with

Microsoft VBScript runtime error '800a000d'
Type mismatch

The byte array is being returned from a COM object created in C#.
Perhaps this is causing a problem?

TIA,

DaveS

*** Sent via Developersdex http://www.developersdex.com ***
Jan 14 '06 #3
Can you do this and comment out the for loop:-

Response.Write "myBArray is: " & VarType(myBArray) & "<br />"
Response.Write "myBArray first element is: " &
VarType(myBArray(LBound(myBArray)))

The first line ought to be 8209 or 8204 and the second should be 17.
"DaveS" wrote:
Thanks for the help. The line still blows up with

Microsoft VBScript runtime error '800a000d'
Type mismatch

The byte array is being returned from a COM object created in C#.
Perhaps this is causing a problem?

TIA,

DaveS

*** Sent via Developersdex http://www.developersdex.com ***

Jan 15 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by cjw | last post: by
8 posts views Thread by Dmitri Shvetsov | last post: by
6 posts views Thread by Aaron | last post: by
7 posts views Thread by Vince Panuccio | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.