'VB6 to VB.NET code conversion string problem

I had a program with code conversion VB6 (on WinXP 32bit) which sends command to RS232 radio modem. I rewrite the code into VB.NET (WinX 64bit) but the output string to serial port is different. For example:

VB6 code:

Chr$(193)

Output is:

VB6output

VB.NET code:

Convert.ToChar(193)

Output is:

VB.Netoutput

I think this has something to do with character tables but cannot find any solution Thanks for any info



Solution 1:[1]

According to this link from Microsoft, Convert.toChar(...) does this:

Converts the value of the specified object to a Unicode character.

My guess is you're getting a unicode, since instead of C1, you're getting C3 81 (Unicode can take 1-4 bytes per char). Perhaps something like this answer would help:

((char)0x00C1).ToString();

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 User51