how to convert VB.6 code to C#?

how to convert VB.6 code to C#?

Post by Konrad L. » Mon, 17 May 2004 07:58:16



why not use the update wizard VB6->VB.NET which is shipped with VS.NET?

--
Konrad -
http://www.yqcomputer.com/
 
 
 

how to convert VB.6 code to C#?

Post by jimi_with_ » Mon, 17 May 2004 11:58:58

Even though Instant C# is billed as a VB.NET to C# converter, I ran it
through and got the following C# code. But since Instant C# leaves
most VB runtime functions as they are (as does the MS upgrade wizard
from VB6 to VB.NET), you'll have to decide what you want to do about
Asc, StrConv, and Hex.

public string Unicode(string c)
{
string Unicode_temp = "";
byte[] x = null;
long a = 0;
long i = 0;
a = Microsoft.VisualBasic.Strings.Asc(c); // where c is a string
x = Microsoft.VisualBasic.Strings.StrConv(c,
Microsoft.VisualBasic.Constants.vbWide, 0); // convert string from 1
byte to 2 byte for unicode
for (i = x.GetUpperBound(0); i >= 0; i--)
{
Unicode_temp = Unicode_temp + "00" + "0" +
Microsoft.VisualBasic.Conversion.Hex(a);
}
return Unicode_temp;
}