C#代码转VB
private void button5_Click(object sender, EventArgs e)
{
byte[] cmd = new byte[6];
cmd[0] = 0x05;
cmd[1] = 0x10;
cmd[2] = 0x00;
cmd[3] = 0x12;
cmd[4] = 0x00;
cmd[5] = 0x27;
serialPort1.Write(cmd, 0, cmd.Length);
}
我自己写了一段VB的,始终不对...希望各位大大可以给我个例子
------解决方案--------------------顶下..........
------解决方案--------------------Private Sub button5_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim cmd As Byte() = New Byte(5) {}
cmd(0) = &H5
cmd(1) = &H10
cmd(2) = &H0
cmd(3) = &H12
cmd(4) = &H0
cmd(5) = &H27
serialPort1.Write(cmd, 0, cmd.Length)
End Sub
------解决方案--------------------VB.NET code
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim cmd As Byte() = New Byte(6) {}
cmd(0) = &H5
cmd(1) = &H10
cmd(2) = &H0
cmd(3) = &H12
cmd(4) = &H0
cmd(5) = &H27
SerialPort1.Write(cmd, 0, cmd.Length)
End Sub
------解决方案--------------------
VB中数组是(,C#,C中是[