wessamzeidan Posted July 1, 2004 Posted July 1, 2004 How can I convert a hexdecimal number to an integer??? Quote Proudly a Palestinian Microsoft ASP.NET MVP My Blog: wessamzeidan.net
Administrators PlausiblyDamp Posted July 1, 2004 Administrators Posted July 1, 2004 Not sure what you mean - do you mean a string formatted as hex that needs to be converted? If so look at the Integer.Parse(...) method - you can specify different numerical styles for the string including Hex. If that isn't what you meant then reply and I'll have another go. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
wessamzeidan Posted July 1, 2004 Author Posted July 1, 2004 do you mean a string formatted as hex that needs to be converted? Yes, this is what I meant, can you please give an en example.... Quote Proudly a Palestinian Microsoft ASP.NET MVP My Blog: wessamzeidan.net
Administrators PlausiblyDamp Posted July 1, 2004 Administrators Posted July 1, 2004 Something like the following Dim i As Integer Dim s As String = "7F" 'Not sure about the formatting you may need to try 0x7f or &H7f i = Integer.Parse(s, NumberStyles.HexNumber) MessageBox.Show(i.ToString()) Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
anjanesh Posted June 11, 2005 Posted June 11, 2005 Was searching for this and ended up here. Thanks PlausiblyDamp. It worked. 0x7f or &H7f wont be accepted in the string for conversion - run-time error. BTW it seems it has to be Globalization.NumberStyles.HexNumber and not just NumberStyles.HexNumber in your code above. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.