TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
aaniculaesei
NA
47
0
a very annoing exception
Apr 30 2005 11:03 AM
Hi , I have the following code: -> in class Calculator: ============== private void radionBtnHexa_CheckedChanged(object sender, System.EventArgs e) { if (radioBtnDecimal.Checked == true) { String str = textBoxResult.Text.Substring(0,textBoxResult.Text.Length-1); textBoxResult.Text = myConvert.ToHex(str); } else { if (radioBtnOctal.Checked == true) textBoxResult.Text = myConvert.ToDecimal(textBoxResult.Text,8); else if (radioBtnBinary.Checked == true) textBoxResult.Text = myConvert.ToDecimal(textBoxResult.Text,2); textBoxResult.Text = myConvert.ToHex(textBoxResult.Text); } // ... } -> in class Converting: ================ public String ToHex(String str) { String hexStr; int counter,reminder; int hexInt; hexStr = str; //hexStr = ToDecimal(str,16); hexInt = Int32.Parse(hexStr); counter=1; hexStr=""; while (hexInt+15>Math.Pow(16,counter-1)) { reminder=(int)(hexInt%Math.Pow(16,counter)); reminder=(int)(reminder/Math.Pow(16,counter-1)); if (reminder<=9) { hexStr=hexStr+(char)(reminder+48); } else { hexStr=hexStr+(char)(reminder+55); } hexInt-=reminder; counter++; } return ReverseString(hexStr); } and I get the following exception: "Input string was not in a correct format" ! :( Any ideas ?!? Please help me because I must get to the bottom of this ! It's bugging me for days ! :( Any thing that would help appreciated ! Thankx, Adisor
Reply
Answers (
2
)
Drag an drop
C# Cookie