line input #filenumber,str
list1.AddItem str

解决方案 »

  1.   

    dim fn as integer
    dim str as string
    fn=freefile()
    open filepath for input as #fn
    do while not eof(#fn)
      line input #filenumber,str
      list1.AddItem str 
    loop
    close #fn
      

  2.   

    把所有内容读入,逐个字符对比找出换行符,然后拆开,然后分别加到listbox。(不知道是不是好方法)
      

  3.   

    修改后的代码是:
    Dim fn As Integer
    Dim str As String
    fn = FreeFile()
    Open "D:\AAA\Data.dat" For Input As #fn
    Do While (Not EOF(fn))
      Line Input #fn, str
      List1.AddItem str
    Loop
    Close #fn