VB6 equivilent wanted

  • Thread starter Thread starter matthew-andrews
  • Start date Start date
M

matthew-andrews

Hi,

I have a string being returned to a VB component from c#. This string
is a byte[] which has been encoded using;

System.Text.ASCIIEncoding e = new System.Text.ASCIIEncoding();
string result = e.GetString(byteArray);

How do I go from this string result to a byte[] using VB6? Any
pointers?
 
Hi,

This newsgroup has dotNet in its name, therefore questions about non Net
versions are done in the VB general newsgroups.

I link this message cross posted to that newsgroup, because there are those
who know probably much better solutions than me.

In the newest Visual Basic version with option infer on it would have been:
\\\
Dim encode as New System.Text.ASCIIEncoding
string result = encode.GetString(byteArray)
///

probably it is in VB6 simply
\\\
string result
result = StrConv(byteArray, vbUnicode)
//
The way strings are used was one of the area's where C# and VB7 became more
complete and consequent then VB6
The StrConv is to convert strings, but it eats most probably as well a byte
array

Cor

PS I don't use the "e" because in C# and VB for Net the e is almost a
keyword as it is used standard by events.
 
I link this message cross posted to that newsgroup,
because there are those who know probably much
better solutions than me.

Linking your response to the VB6 group, as you have done, may actually be a
good idea because you are absolutely correct when you say there are people
there who know much better solutions than yourself , but that's not the
reason you did it, and you know very well it isn't. The reason you did it is
so that you could post the following remark of yours to the VB6 group:
The way strings are used was one of the area's where
C# and VB7 became more complete and consequent
then VB6

You are an annoying little troll, Ligthert. The sooner you stop posting
deliberately provocative stuff to the VB6 group in your deliberate and long
running attempt to disrupt it the better it will be for all of us.

You do not deserve to be an MVP and it is my opinion that Micro$oft should
sack you immediately before you do any more harm to their reputation.

Mike
 
Cor is right. StrConv will take a byte array. vbUnicode converts to
Unicode using the current system code page, but ASCII (characters
0-127) are supported on all code pages, so that's a side issue here.

(I posted some questions about StrConv here just the other day so I'm
feeling more confident about what it does and I'll answer the
question. Anyway I'm sure the others will set me straight if I'm
wrong.)
 
Back
Top