Serial Port: Writing Codes in HEX, not in ASCII

Msgbox ("Hello World") :)
I have some troubles with my serial Port. This time, I am adressing a DLP Projecotor. (PJ).
The PJ listens only to commands it receives in hex format.
The command 02h 01h 3e 03 makes the PJ switching on.
When I write
ComPort.Write("02H" & "01H" & "3E" & "03H")
to the PJ, my Serial Port Monitor(monitoring HEX) says
30 32 48 30 31 48 33 45 30 33 48
Thus I wrote some ASCII to the PJ and the Oj does nothing.
When I write
ComPort.Write(Chr(2) & Chr(1) & Chr(122) & Chr(3))
my portmonitor is saying:
02 01 7A 03 and the PJ reacts correctly.
It is quite long winded changing the decimal 122 to hex 7a.

Now we come to my question:
Is there a chance of writing hex codes directly to the port?
Something like
ComPort.Wrtiningsomehex (02 01 7A 03)?
Are there any workarounds? A automatic decimal to hex concerter method or something like this?
Thank you very much!!
Greetings,
Carsten

[1119 byte] By [roadresident] at [2007-12-24]
# 1

Dim x As Integer = 10

' One way

Dim s As String = Convert.ToString(x, 16)

MsgBox(s)

' One way

s = Hex(10)

MsgBox(s)

' add leading zero

If s.Length < 2 Then s = New String("0"c, 2 - s.Length) & s

MsgBox(s)

TallDude at 2007-8-31 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 2
How about this:
Dim cmd() As Byte = {&H02, &H01, &H7A, &H03}
ComPort.Write(cmd, 0, cmd.length)

nobugz at 2007-8-31 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 3

Hi,

Is your problem solved? If yes then could you please mark reply as answer?

Thank you,
Bhanu.

BhanuPrakashNunna-MSFT at 2007-8-31 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 4
Thanks a lot, it works fine now!
Carsten
roadresident at 2007-8-31 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...