473,394 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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 11353
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: jeff | last post by:
how do you convert form byte to Int32 while retaining the binary value of the byte array
4
by: cjw | last post by:
I need to read an 'unsigned char' array and save it as a bit array (values are only 0s or 1s). When processing, have to do math operations such as summing up the values etc. Pl let me know an...
8
by: Dmitri Shvetsov | last post by:
Hi All, Did somebody try to get the Hash code from byte array? The method exists, the program is compilable but...))) Try!-) Every time you can get the different code from the same array, and...
6
by: Aaron | last post by:
How converts a string to a byte and then add it to a byte array? I tried 2 different methods and both failed to work. For example: Dim A as string Dim B(2) as Byte 'array (from 0 to 2) ...
6
by: moondaddy | last post by:
I'm writing an app in vb.net 1.1 and need to convert a byte array into a string, and then from a string back to a byte array. for example Private mByte() as New Byte(4){11,22,33,44} Now how...
5
by: philip | last post by:
Here is some lines of code than I wrote. You can copy/paste theis code as code of form1 in a new project. My problem is this one : I try to write in a file a serie of bytes. BUT some bytes...
7
by: Vince Panuccio | last post by:
Hello, If im looking for a pattern of byes in a byte array, what would be the best approach? I could convert the array into a string and use IndexOf recursivly by remembering the last...
2
by: adypoly | last post by:
Hi guys... I am having a typical problem in using one of the native dll in C# I'll explain what am trying to do, I've a dll written in C language which i am trying to include in my C# project,...
4
by: | last post by:
Hi all, I want to create a method that does the following: 1) Programmatically instantiate a new XmlDataSource control 2) For each file in a named directory, make a "FileSystemItem" element 3)...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.