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.
Unfortunately, activation email could not send to your email. Please try again.

VB.Net to C# Conversion Help

Thread ID:

Created:

Updated:

Platform:

Replies:

12365 Mar 26,2004 10:30 PM Mar 30,2004 06:52 AM Windows Forms 1
loading
Tags: FAQ
Steve Graddy
Asked On March 26, 2004 10:30 PM

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

Steve Graddy
Replied On March 30, 2004 06:52 AM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;