Get hexadecimal value from TextBox

hi,i m new to this area.i m doing XML operations using c-sharp. have two textboxes.i want to enter hexadecimal input like this 0x000,0x0ff.
my problem is: i got format exception when i am entering hexadecimal values into textbox and perform some operations.i want to display difference between two hexadecimal numbers.my code is like this.

int i = Int32.Parse(this.textBox1.Text, System.Globalization.NumberStyles.HexNumber); //, System.Globalization.NumberStyles.HexNumber | System.Globalization.NumberStyles.AllowHexSpecifier);
int j = Int32.Parse(this.textBox2.Text, System.Globalization.NumberStyles.HexNumber); //, System.Globalization.NumberStyles.HexNumber);
int difference = j-i;
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories