Split Inputvalue into 2 hex encoded bytes if Input>255
Why try and manipulate the number as a string?

Personally I would convert the input to a number and then manipulate it and finally convert it back to a string, if you need to.  However I would have thought C# has a way of making a text box accept Hex numbers and returning an Int (I don't know I don't do GUIs.)

Using your example number 0x2ee.
If the number if greater than 0xFF then it will take more than one byte to store it.  So to split the value you can do lowerByte = number % 256.  The upper byte is simply upperByte = (number - lowerByte) &gt;&gt; 8

So putting this into code

static byte[] SplitNumber (Int16 number)
{
    byte[] returnValue = new byte[2];
    returnValue[0] = Convert.ToByte(number % 256);
    returnValue[1] = Convert.ToByte((number - returnValue[0]) &gt;&gt; 8);
    return returnValue;
}


Now you have your bytes, you can format them in the text box as you like,