Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to read a file and import to a listbox

Status
Not open for further replies.

kloner

Programmer
May 15, 2000
79
AU
Hi guys,

I was wondering if someone out there could help me with some simple VB code. I need to read the following into a combo box :


"Hilton", "150.00"
"George Hotel", "130.00"
"Holiday Inn", "135.00"
"Novotel", "200.00"
"Regency", "120.00"
"YMCA", "80"


I would like the data to then be populated in a combobox. Thankyou so much for any help. You guys rock.

PS: Any really good VB sites out there that you recommend? Especially code snippit sites?

Ta. kloner


 
Hi,

----------------------------------------------------------
Dim InLine as string, InFile as byte

Infile=freefile
Open MyfileName for Input as #InFile
While not eof(infile)
line input #infile, InLine
combo1.Additem InLine 'maybe you want to remove the quotes : replace(Inline,"""","")
wend
close infile
-----------------------------------------------------------

is a good place to look for codes.

Good luck,
Sunaj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top