winsock通讯 16进制byte 程序问题 数组不能赋值
程序代码:
Private Sub form_load() If Winsock1.State <> sckClosed Then Winsock1.Close End If Winsock1.RemoteHost = "221.130.45.197" Winsock1.RemotePort = 1001 Winsock1.Protocol = 0 ' TCP 协议 Winsock1.LocalPort = 0 Winsock1.Connect End Sub Private Sub Image1_Click() Dim nobiao(), cs As Byte Dim no As String no = "68999999999999680A06" & "Hex(Text1.Text)" nobiao = no Dim i As Integer For i = 0 To 14 cs = cs + nobiao(i) Next i nobiao(15) = Hex(cs) nobiao(16) = &H16 Winsock1.SendData nobiao End Sub Private Sub Image2_Click() Dim data() As Byte Call set1_data_analy(data()) Winsock1.SendData data End Sub Private Sub set1_data_analy(settime() As Byte) Dim sum As Integer Dim dt(0 To 9) As String sum = 14 + Text2.Text + Text3.Text + Text4.Text + Text5.Text + Text6.Text + Text7.Text While sum >= 256 sum = sum - 256 Wend While sum < 16 dt(6) = "0" & "Hex(sum)" Wend dt(0) = "Hex(Text7.Text)" dt(1) = "Hex(Text6.Text)" dt(2) = "Hex(Text5.Text)" dt(3) = "Hex(Text4.Text)" dt(4) = "Hex(Text3.Text)" dt(5) = "Hex(Text2.Text)" dt(6) = "Hex(sum)" Dim a As String a = "68999999999999680806" & "dt()" & "16" settime = a End Sub帧格式是类似这样的
我越改越晕 越改越报错 不知道怎么改才是对的了 麻烦大神们帮我看一下吧~
目前的报错是nobiao=no 这 报错数组不能赋值