VB.net 错误 1 类型“Byte”的值无法转换为“Byte 的 1 维数组”。怎么回事? 20
部分相关代码如下:Dimbytesnd(17)AsByteDimaddrAsByte=0DimiAsByte=0DimbyteAddrAsByte=addr+iDimte...
部分相关代码如下:
Dim bytesnd(17) As Byte
Dim addr As Byte = 0
Dim i As Byte = 0
Dim byteAddr As Byte = addr + i
Dim temp1 As Byte = Convert.ToByte(Hex(topV).Substring(2, 4))
bytesnd = (byteAddr, &HAB, &HCD, &H1, &HA, &H2, &H0, &H0, temp1, temp2, &H0, 0, 0, 0, 0, 0, 0, 0) 展开
Dim bytesnd(17) As Byte
Dim addr As Byte = 0
Dim i As Byte = 0
Dim byteAddr As Byte = addr + i
Dim temp1 As Byte = Convert.ToByte(Hex(topV).Substring(2, 4))
bytesnd = (byteAddr, &HAB, &HCD, &H1, &HA, &H2, &H0, &H0, temp1, temp2, &H0, 0, 0, 0, 0, 0, 0, 0) 展开
1个回答
展开全部
没见过一次性给数组多个元素赋值的,只有在定义时可以初始数组元素,但不是圆括号
Dim addr As Byte = 0
Dim i As Byte = 0
Dim byteAddr As Byte = addr + i
Dim temp1 As Byte = Convert.ToByte(Hex(topV).Substring(2, 4))
Dim bytesnd() As Byte = {byteAddr, &HAB, &HCD, &H1, &HA, &H2, &H0, &H0, temp1, temp2, &H0, 0, 0, 0, 0, 0, 0, 0}
Dim addr As Byte = 0
Dim i As Byte = 0
Dim byteAddr As Byte = addr + i
Dim temp1 As Byte = Convert.ToByte(Hex(topV).Substring(2, 4))
Dim bytesnd() As Byte = {byteAddr, &HAB, &HCD, &H1, &HA, &H2, &H0, &H0, temp1, temp2, &H0, 0, 0, 0, 0, 0, 0, 0}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询