Click to See Complete Forum and Search --> : Characters


Veluru
September 14th, 1999, 04:08 PM
Hi,
i have a problem with characters in Visual basic. somehow i need a character array and VB has something called Byte which is similar to that. i have the following code.

Dim hfiles as String * 80
Dim i As Integer
Dim temp(80) As Byte
Dim midchar As String

hfiles = "C:\Refprop\FLUIDS\R32.fld"

For i = 1 To 80
midchar = Mid(hfiles, i, 1)
temp(i) = CByte(midchar)
Next i

it is supposed to convert the character to byte but it is still giving a type mismatch error. Could anyone please tell me why this is happenning and how i could correct it.
Thanks,
Veluru

Lothar Haensler
September 15th, 1999, 01:34 AM
you can assign a string to a byte array like this

Dim str1 as string * 10
str1 = "test"
Dim b() as Byte
b = str1