-2

In c# i have a trackbar with range of 0-254. I want to convert each digit to hex byte, meaning that 250 will be "32-35-30" and display that in a text box how can i do that?

I dont have any code for example

SHR
  • 7,940
  • 9
  • 38
  • 57
JoZee001
  • 1
  • 4

1 Answers1

0

It is a simple task:

string s = "250";
byte[] array = System.Text.Encoding.ASCII.GetBytes(s);
string s2=BitConverter.ToString(array);

Now s2 has the desired output.

SHR
  • 7,940
  • 9
  • 38
  • 57