Results 1 to 4 of 4

Thread: load txt files

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 1999
    Location
    Fremont, Ca, 94538
    Posts
    40

    Post

    hi, i am tryin' to load a *BIG* text file into a listbox, i put the doevents so that the user won't think the program is freezing, but it's slow. Are there any better way? Thank in advance.

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,176

    Post

    How are you bringing in the Text?
    Are you using Line Input#/Input#?
    Try opening the File for Bianry Access Read, then use the Get# Function to Grab Large chunks of the Data and Store the whole File in a String Variable.

    This will reduce the amount of File Access and will be Faster when you have to Manipulate the Data when Breaking it down and putting it in the Listbox.


    ------------------
    Aaron Young
    Analyst Programmer
    aarony@redwingsoftware.com
    adyoung@win.bright.net

  3. #3
    Addicted Member
    Join Date
    Oct 1999
    Posts
    232

    Post

    Maybe you don't need listbox?
    Try the TextBox Control:

    Private Sub Command1_Click()

    Dim fnumber As Integer
    Dim fname As String

    Screen.MousePointer = vbHourglass

    fnumber = FreeFile
    fname = "d:\MyBigFile.txt"

    Open fname For Input As #fnumber

    Text1 = Input$(LOF(fnumber), fnumber)

    Close #fnumber

    Screen.MousePointer = vbDefault

    End Sub

    ------------------
    smalig
    smalig@hotmail.com
    http://vbcode.webhostme.com/


  4. #4

    Thread Starter
    Member
    Join Date
    Oct 1999
    Location
    Fremont, Ca, 94538
    Posts
    40

    Post

    smalig, i am not tryin' to open a text file to a textbox like an editor, but thanks for respond anyway. Thanks aaron, i'll try that way.

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