0

Possible Duplicates:
Convert a string containing a hexadecimal value starting with “0x” to an integer or long in C#
How to parse hex values into a uint?

I have a textbox that can have "0xFFFF" in it's Text property. I need to convert it to an int32.

How do I do that? I have tried:

Int32.Parse( MyTextBox.Text, NumberStyles.HexNumber )

and

Int32.Parse( MyTextBox.Text, NumberStyles.AllowHexSpecifier)

and get the following error message:

"Input string was not in a correct format."

Please help!

Community
  • 1
  • 1
Vance Smith
  • 2,215
  • 6
  • 30
  • 34

1 Answers1

1

take off the 0x and just parse the actual hex number.

The Lazy Coder
  • 11,232
  • 4
  • 49
  • 69