Showing posts with label Hex to Ascii Conversion. Show all posts
Showing posts with label Hex to Ascii Conversion. Show all posts

Wednesday, May 23, 2007

Hex to Ascii Conversion in C#

try
{
int n =0;
string temp;
string temp2 = "";
for(int i = 0; i {
temp = txtKeyA.Text.Substring(i,2);
n = Convert.ToInt32(temp, 16);
//To convert it to a character, simply cast the integer to char
temp2 = temp2 + ((char)n).ToString();
}
txtKeyA.Text = temp2;
this.btnToHex.Enabled = true;
this.btnToAscii.Enabled = false;
}
catch(Exception eE)
{
// MessageBox.Show(eE.ToString());
MessageBox.Show("Failed to convert!!! Please check your input format!");
}