Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.visual.basic    |    MS Visual Basic discussions, NOT dot-net    |    10,840 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 8,975 of 10,840    |
|    Rick Rothstein to All    |
|    Re: Listbox    |
|    12 Nov 04 13:53:52    |
      From: rickNOSPAMnews@NOSPAMcomcast.net              > I have a listbox that I want to populate with information from a text       file.       > For each index in the listbox, I want to load the next line of the       text       > file, until there are no more lines. I have the code to open and read       each       > line from the text file, but I cannot figure out a way to read a line,       put       > it into the listbox, then go to the next line and repeat the process.       I know       > it will have to use a For... Next loop, but can't get the       configuration       > right. Any help would be greatly appreciated!              Usually it is a good idea to post the code that is not working as you       expect (or that you have so far). That way, we can adapt our answers to       your style of programming or even make suggestions of ways we might       approach the problem differently. Without seeing your code, the best we       can do is give you code and hope it makes sense to you or, if it       doesn't, that you will try and read up on the parts that are unfamiliar       to you.              Dim FF As Long       Dim LineOfText As String       FF = FreeFile       Open "c:\temp\Bi-Weekly Work Schedule (2009).txt" For Input As #FF        Do While Not EOF(FF)        Line Input #FF, LineOfText        ' If test makes sure you don't add a blank line        If Len(LineOfText) Then List1.AddItem LineOfText        Loop       Close #FF              Rick - MVP              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca