开发者

How do I convert 0xFFFF to an int32 in c# [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicates:

Convert a string containing a hexadecimal value starting with “0x” to an integer or long in C#

How to pa开发者_JAVA技巧rse 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!


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜