Click to See Complete Forum and Search --> : whiles, files, and listboxes


Chronovore
May 15th, 2001, 09:57 AM
I'm trying to get a list of items in a text file to be displayed in a listbox control. unfortunatly I don't know exactly how. This is what I have and it doesn't do it. By the way if it makes a difference, the file could hold nothing before #endlist#

'loading items from file into array
While buffer <> "#endlist#"
input filenum, buffer
list(i) = buffer
i = i + 1
Wend

'from the array into the listbox
While buffer <> "" and i <= listMax
lstBox.AddItem(list(i))
i = i + 1
Wend



these are both just snippets of code, they DO NOT come directly after each other
now all this does is give me a headache and displays the "#endlist#" in the listbox. help... :)

Iouri
May 15th, 2001, 10:08 AM
Here is an example how to put every string from the text file to listbox
Open "c:\temp\temp.txt" For Input As #1 'to read from
Do While Not EOF(1)
Line Input #1, sLine
List1.AddItem sLine
Loop
Close #1


'You might want to extract some data from sLine. You can do it before adding to the listbox


Iouri Boutchkine
iouri@hotsheet.com