Try ' Write a line to the serial port Dim hexstr As String = "" Dim s As String Dim v As Int16 = 0 s = textBox1.Text For Each c As Char In s v = CShort(Format(c)) hexstr = hexstr + v.ToString Next SerialPort1.WriteLine(hexstr) textBox1.Text = "" Catch ex As System.Exception MessageBox.Show(ex.Message) End Try End Sub