Results 1 to 3 of 3

Thread: close open file[RESOLVED THANKS]

Hybrid View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2002
    Location
    scotland
    Posts
    72

    Unhappy close open file[RESOLVED THANKS]

    Hi i am using this code to populate a listview list it works fine
    but i also have an other four text files i want to be able to
    choose from in a combo box,i can clear the listview text but when i
    select the new text file to open from the combo box list i get an
    error saing file already open,i take it that i have to first close
    the file that i had first opend?how would i do this?

    ----------------------------------------------------------------------------
    --------VB CODE------

    Open (App.Path & "\123.txt") For Input As #1 'Open File
    Do While Not EOF(1) 'While not end of file
    Line Input #1, TextLine 'Read Line From File
    Set ListView = ListView1.ListItems.Add() 'asign "object"
    ListView.Text = Split(TextLine, ",")(0)
    ListView.SubItems(1) = Split(TextLine, ",")(1)
    ListView.SubItems(2) = Split(TextLine, ",")(2)
    ListView.SubItems(3) = Split(TextLine, ",")(3)
    ListView.SubItems(4) = Split(TextLine, ",")(4)
    ListView.SubItems(5) = Split(TextLine, ",")(5)
    ListView.SubItems(6) = Split(TextLine, ",")(6)
    ListView.SubItems(7) = Split(TextLine, ",")(7)
    ListView.SubItems(8) = Split(TextLine, ",")(8)
    ListView.SubItems(9) = Split(TextLine, ",")(9)
    ListView.SubItems(10) = Split(TextLine, ",")(10)
    ListView.SubItems(11) = Split(TextLine, ",")(11)
    ListView.SubItems(12) = Split(TextLine, ",")(12)
    ListView.SubItems(13) = Split(TextLine, ",")(13)
    ListView.SubItems(14) = Split(TextLine, ",")(14)
    ListView.SubItems(15) = Split(TextLine, ",")(15)
    ListView.SubItems(16) = Split(TextLine, ",")(16)
    'ListView.SubItems(17) = Split(TextLine, ",")(17)


    Loop
    Last edited by bosscat; Sep 6th, 2003 at 08:02 PM.

  2. #2

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2002
    Location
    scotland
    Posts
    72
    Thanks MARTIN, that solved my problem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width