hi guys
i have written a small program to control a camera through rs485 now the program works ok for one camera but i dont seem to be able to change the byte that changes the camera number at run time through a drop down menu ie cam 1 cam 2 perhaps someone might be able to help me
thanks in advance

section of code


Public port As String
    Public cam As Byte

    Dim cam1 As String

    'Public cam As SByte
    Public quar() As Byte = {&HFF, &H1, &H0, &H53, &H0, &H1, &H54}
    Public preset() As Byte = {&HFF, &H1, &H0, &H3, &H0, &H1, &H5}
    Public callpre() As Byte = {&HFF, &H1, &H0, &H7, &H0, &H1, &H9}
    Public focusfar() As Byte = {&HFF, &H1, &H0, &H80, &H0, &H0, &H81}
    Public focusnear() As Byte = {&HFF, &H1, &H1, &H0, &H0, &H0, &H2}
    Public zoomout() As Byte = {&HFF, &H1, &H0, &H40, &H0, &H0, &H41}
    Public camoff() As Byte = {&HFF, &H1, &H8, &H0, &H0, &H0, &H9}
    Public camon() As Byte = {&HFF, &H1, &H88, &H0, &H0, &H0, &H89}
    Public stopsend() As Byte = {&HFF, &H1, &H0, &H0, &H0, &H0, &H1}
    Public zoomin() As Byte = {&HFF, &H1, &H0, &H20, &H0, &H0, &H21}
    Public panleft() As Byte = {&HFF, &H1, &H0, &H2, &H40, &H0, &H43}
    Public panright() As Byte = {&HFF, cam, &H0, &H4, &H40, &H0, &H45}
    Public tiltup() As Byte = {&HFF, &H1, &H0, &H8, &H0, &H40, &H49}
    Public tiltdown() As Byte = {&HFF, &H1, &H0, &H16, &H0, &H40, &H57}
    '  public tiltdown() As Byte = {&HFF, &H1, &H0, &H16, &H0, &H32, &H49}
    Public test() As Byte = {&HFF, &H1, &H0, &H23, &H0, &H5F, &H83}

you will see on panright (cam) this is what i need to change to 1 or 2 or 3

menu drop down

Me.Cam1ToolStripMenuItem1.Checked = True
        cam = 1
        '  lblcamdisp.Text = "Camera Id" + " " + cam
        If Me.Cam1ToolStripMenuItem.Checked = True Then
            Me.PortToolStripMenuItem.Enabled = True
            lblcamdisp.Visible = True
            mnuItem2.Checked = False
            '    mnuItem3.Checked = False
            '    mnuItem4.Checked = False
            '    mnuItem5.Checked = False
            '    mnuItem6.Checked = False
            '    mnuItem7.Checked = False
            mnuPortset.Enabled = False
            pnlPortsel.Visible = False
            lblPort.Visible = False
            lblbauddisp.Visible = False
            lblcamdisp.Visible = False
        End If

thankyou all again


>writeing hex to serial port

You could use System.IO.Ports.SerialPort class.

>writeing hex to serial port

You could use System.IO.Ports.SerialPort class.