Im useng visual basic to make a control program for a usb relay board

This is the c# code that i know works

private void button1_ON_Click(object sender, EventArgs e)
        {
            serialPort1.Write(new byte[] { 0xFF, 0x01, 0x01 }, 0, 3);
            panel1.BackColor = Color.Lime;
        }

or
VB 6

Private Sub cmdOn_Click()
With MSComm1
'make sure the serial port is open
If .PortOpen = False Then .PortOpen = True
'send the data
.Output = Chr$(255)
.Output = Chr$(1)
.Output = Chr$(1)
End With 'MSComm1
End Sub

Any ideas on how to get it to work for VB? I really dont want to rewrite the entire thing, any help much appicated.

Oh the ff 01 01 controls the realy

ff: not sure
01: the realy number
01: Turn the relay on

Also im useing vb express 2008
if that helps at all

private void button1_ON_Click(object sender, EventArgs e)
{
serialPort1.Write(new byte[] { 0xFF, 0x01, 0x01 }, 0, 3);
panel1.BackColor = Color.Lime;
}

C# code above become in this following code :

Private Sub button1_ON_Click(ByVal sender As Object, ByVal e As EventArgs)
    serialPort1.Write(New Byte() {255, 1, 1}, 0, 3)
	panel1.BackColor = Color.Lime
End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.