Question Alpahbet to hex number conversion

Ugojallas

Member
Joined
Apr 5, 2012
Messages
12
Programming Experience
Beginner
i am writing a program that uses two rich textBoxs that when an alphabet is written in the first one it will change to hexdecimal number in the second one. but i can't seems to get it right.what i want is some thing like this FIRST TEXTBOX(i will come like to go to school) then the SECOND RICH TEXTBOX(49 57494C4C 4C494B45 544F 474F 544F 5343484F4F4C).pls can someone help me out
 
You can handle the KeyPress event of the control to receive notification when a character is entered and you can use Char.IsLetter to determine whether that character is a letter. The Convert.ToInt32 method will then get you the Unicode value for that character and the Convert.ToString will convert that number to a hexadecimal String.

You have to think about what you're going to do if the user deletes characters or moves the caret to somewhere other than the end of the text. The simplest option would to be to convert the whole text every time, but that might get a little inefficient for long text. I'm not sure how efficient the alternatives would be though.
 
Back
Top Bottom