i have a program (VB6.0) which runs fine, it called a ocx and it return a 3 bytes string.

now, i rewrite the program in VB.net, and again the ocx return as Object type

firstly, i try this:

dim x as String = ocx.get_field("id")

which return x as a string with 1 character only. what i expect is 3 characters

then, i try to do as follows:

dim x as Object = ocx.get_field("id")
dim b as Byte() = CType(x, Byte())

which results in InvalidCastException.

Then, i try in this way:

Dim b As Byte() = System.Text.Encoding.Unicode.GetBytes(ocx.get_field("id"))
dim y as String = System.Text.Encoding.Default.GetString(b)

which gives a string of 2 characters, still i got 2 characters only. I lost the last byte anyway.

Please Help!!