比如
Dim b(1 to 20) As Byte如何将Byte数组b(5)到b(10) 赋值给字符串s?

解决方案 »

  1.   

    Dim a() As Byte
        Dim c As String
        c = "12345678997"
        a() = c
        c = ""
       c = a
    c = Mid(c, 5, 10-5)
      

  2.   

    Dim a(1 To 20) As Byte
         Dim j
         For j = 1 To 20
         a(j) = Asc(j)
         
         Next
         Dim c As String
         c = ""
          For j = 5 To 10
         c = c & Chr$(a(j))
         
         Next
      

  3.   

    Dim a(20) As Byte
    dim s as strings=a  '这儿也许根据需要用strconv
    s=mid(a,x,y)
      

  4.   

    测试通过
    Private Sub Command1_Click()
        Dim n As Long
        Dim arrBytes() As Byte
        
        '读出二进制数据到数组
        Open "d:\draw.ico" For Binary As 1
            n = LOF(1)
            ReDim arrBytes(1 To n) As Byte
            Get 1, , arrBytes
        Close 1
        
        '读取二进制数组数据到字符串
        Dim fileCon As String
        Dim i As Long
        For i = 10 To 150
            fileCon = fileCon & CStr(arrBytes(i))
        Next
        MsgBox fileCon
        
    End Sub
      

  5.   


       一个for和连接运算符"&"不就OK了!