Archived

This topic is now archived and is closed to further replies.

thomashun

VB help with reading from file to combobox

Recommended Posts

ok I got a .txt that goes something like this 3 "Name" "other name" "street" 2 1 Well anyway how do you read the "Name" into the combobox because i keep getting all the info to read in instead of just the name.

Share this post


Link to post
Share on other sites
Use a TextStream to read in one line at a time:
In your project, set a reference to Microsoft Scripting Runtime

dim fso as new FileSystemObject
dim ts as TextStream

set ts = fso.OpenTextFile("name", I/O mode etc...)

Do While ts.AtEndOfStream = False
Combo1.AddItem (ts.ReadLine)
Loop

ts.Close


Edited by - noparity on July 23, 2001 12:16:06 PM

Share this post


Link to post
Share on other sites