PDA

View Full Version : File to List box


PurpleParrot
02-05-2006, 12:56 PM
Dear Fiends,
I am trying to do this:
I have a text file which has two colums seperated by a tab char. and it's quite long so I want to automate the following:

I want to read the contents of the file into a list box, where the first column is the itemtext and the text after the tab char will be the itemdata. Then I must save my project at runtime because I want these values saved.

I have tried to do this on my own without success!

Please rescue!

PP

TJ_Tigger
02-05-2006, 01:39 PM
Look at the TextFile.ReadToTable. Once you have the text file in a table, use a for loop to step through the table and for each item search for the \t (tab) character. Then with the tab position found use String.Left and String.Mid to extract the two components, then add to the ListBox using those two items.

Hope that helps get you started, there are some great examples in the Examples forum on using list boxes.

Tigg