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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I populate multicolumn listbox from textfile?

Status
Not open for further replies.

rvr

Programmer
Jan 26, 2000
16
ZA
Hi,

I have a text file (tab delimeted) with three 'fields'. I would like to populate a listbox with 3 columns with the contents of the text file. Is that possible, and if it is, how do I do that?

Thanks in advance,

Rvr [sig][/sig]
 

I think it might be easier to use a ListView control instead of a listBox. It is also much more powerful.

Setting tab alignments in a listbox is a pain unless you use a fixed-width type of font.

If you need help with a ListView control, let me know! [sig][/sig]
 
But to answer the question, to get the contents of the file into the listbox, whatever control you choose, you will have to read the file and do AddItem, or the correct method of the control for every line in the file.

OR

If you are using ADO, create a recordset on the file and loop through the recordset.

Simon [sig][/sig]
 
Thanks for your responses! Because I am in a hurry to get this finished, I used filesystemobject, read every line, and AddItem to the listbox. That worked just fine. But I am curious about the ListView control. I've never worked with it before, and would definitely give it a try.

Thank you,
rvr [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top