Public Function HexToArr(Str As String) As Byte()
Dim C As Integer, i As Integer, Arr() As Byte, CH As String
On Error GoTo hErr
C = Len(Str) \ 2 - 1
ReDim Arr(C)
For i = 0 To C
CH = Mid(Str, i * 2 + 1, 2)
Arr(i) = CByte("&H" & CH)
Next
HexToArr = Arr
hErr:
End Function
Public Function HexToArr(Str As String) As Byte()
Dim C As Integer, i As Integer, Arr() As Byte, CH As String
On Error GoTo hErr
C = Len(Str) \ 2 - 1
ReDim Arr(C)
For i = 0 To C
CH = Mid(Str, i * 2 + 1, 2)
Arr(i) = CByte("&H" & CH)
Next
HexToArr = Arr
hErr:
End Function
MSComm1.Output=HexToArr("AABBCC")
#3
Public Function HexToArr(Str As String) As Byte()
Dim C As Integer, i As Integer, Arr() As Byte, CH As String
On Error GoTo hErr
C = Len(Str) \ 2 - 1
ReDim Arr(C)
For i = 0 To C
CH = Mid(Str, i * 2 + 1, 2)
Arr(i) = CByte("&H" & CH)
Next
HexToArr = Arr
hErr:
End Function
Public Function HexToArr(Str As String) As Byte()
Dim C As Integer, i As Integer, Arr() As Byte, CH As String
On Error GoTo hErr
C = Len(Str) \ 2 - 1
ReDim Arr(C)
For i = 0 To C
CH = Mid(Str, i * 2 + 1, 2)
Arr(i) = CByte("&H" & CH)
Next
HexToArr = Arr
hErr:
End Function
MSComm1.Output=HexToArr("AABBCC")
这是怎么回事啊,VB怎么说“实时错误,无效的属性值”?
Dim Arr As Byte
Arr = CByte("&H" & 11)
MSComm1.Output = Arr
Public Function HexToArr(Str As String) As Byte()
Dim C As Integer, i As Integer, Arr() As Byte, CH As String
On Error GoTo hErr
C = Len(Str) \ 2 - 1
ReDim Arr(C)
For i = 0 To C
CH = Mid(Str, i * 2 + 1, 2)
Arr(i) = CByte("&H" & CH)
Next
HexToArr = Arr
hErr:
End Function
MSComm1.Output=HexToArr("AABBCC")
这是怎么回事啊,VB怎么说“实时错误,无效的属性值”?
Dim Arr As Byte
Arr = CByte("&H" & 11)
MSComm1.Output = Arr