We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

VB.Net to C# Conversion Help

I am having a problem converting one line of code in this VB.Net Function. I have marked the line below in its context. In the converted C# code I am getting a error stating "Input string was not in a correct format". Is there anyone out there that can shed some light on fixing this line.. I have included the entire function so that you may see the context. The VB.Net line is : lChar = CInt("&H" & Mid(sMD5, (lCount * 2) - 1, 2)) Mod 32 The Converted C# is : lChar = Convert.ToInt32("&H" + Strings.Mid(sMD5, (lCount * 2) - 1, 2)) % 32; Thanks for any help sent this way... Steve Graddy orgbrat@orgbrat.com

1 Reply

SG Steve Graddy March 30, 2004 11:52 AM UTC

Just in case anyone was interested, here is the solution: lChar = Convert.ToInt32(Strings.Mid(sMD5, (lCount * 2) - 1, 2),16) %32; The key was adding the 16 format specifier. >I am having a problem converting one line of code in this VB.Net Function. >I have marked the line below in its context. In the converted C# code I am getting >a error stating "Input string was not in a correct format". Is there anyone out there >that can shed some light on fixing this line.. I have included the entire function so >that you may see the context. > >The VB.Net line is : lChar = CInt("&H" & Mid(sMD5, (lCount * 2) - 1, 2)) Mod 32 > >The Converted C# is : lChar = Convert.ToInt32("&H" + Strings.Mid(sMD5, (lCount * 2) - 1, 2)) % 32; > >Thanks for any help sent this way... > >Steve Graddy >orgbrat@orgbrat.com

Loader.
Up arrow icon