dim fileNum as integer
fileNum = FreeFile
Open fileName For Random As #fileNum  Len = recLen  'reclen是要已得
                                               的固定长度
    While Not EOF(fileNum)
   Get #fileNum , , tmpRecord
    text1(i).text=tmpRecord
    i=i+1
     Wend
   close #fileNum

解决方案 »

  1.   

    dim fileNum as integer
    fileNum = FreeFile
    Open fileName For Random As #fileNum  Len = recLen  'reclen是要已得
                                                   的固定长度
        While Not EOF(fileNum)
       Get #fileNum , , tmpRecord    ''这一句好象有问题,调不通!!!!
        text1(i).text=tmpRecord
        i=i+1
         Wend
       close #fileNum
    还有没有高人啊,请赐教!
      

  2.   

    是没定义吗, dim tmpRecord as string
    reclen=len(tmpRecord)
      

  3.   

    Private Sub Command3_Click()
    Dim per2 As person
    i = i + 1
    Open "D:\person2.txt" For Random As #1 Len = Len(per2)
       per2.no = Text4.Text
       per2.name = Text5.Text
       per2.age = Text6.Text
       Put #1, i, per2
    Close
       Text4.Text = ""
       Text5.Text = ""
       Text6.Text = ""
    End Sub
    Private Sub Command4_Click()
    Dim per2 As person
     no1 = Val(Text4.Text)
     name1 = Text5.Text
     age1 = Val(Text6.Text)
    Open "D:\person2.txt" For Random As #1 Len = Len(per2)
    Do While Not EOF(1)
        i = i + 1
      Get #1, i, per2
        no2 = per2.no
        name2 = per2.name
        age2 = per2.age
      If no2 = 0 Or age2 = 0 Then Exit Do
      If no1 = no2 Or name1 = name2 Or age1 = age2 Then
        Text4.Text = per2.no
        Text5.Text = per2.name
        Text6.Text = per2.age
        Close
        GoTo 100
      End If
    Loop
     MsgBox "查无此人"
    100
    Close
    End Sub