PDA

Click to See Complete Forum and Search --> : load txt files


dungism
Dec 16th, 1999, 10:47 AM
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.

Aaron Young
Dec 16th, 1999, 09:08 PM
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

smalig
Dec 16th, 1999, 09:09 PM
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/

dungism
Dec 17th, 1999, 11:21 AM
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.