I'm receiving data using serial port, and I'm use the following code to convert the string to hex representation and show it in the richtextbox5:

```
string hex = "";
            foreach (char c in RXstring)
            {
                uint tmp = c;
                hex += String.Format("{0:X2}", (uint)System.Convert.ToInt16(tmp.ToString())) ;
            }

            richTextBox5.AppendText(hex + "   <= Hex");

```

where RXstring is where I store data from serial port.
 The **problem** is :
when I send data like 127(decimal)=> 01111111(binary)=> 7F(hex) it converted correctly, while when I send data like 191 or 167 which all share that the most significant bit is 1 and they are all 8 bits the **output** is 3F despite the other bits, (the representation of any 8 bits start with 1 is 3F), whats wrong with my code?
can you help, thx.