By Rob Crombie.
This example loads a file of this form into a series of ListBoxes:
[ANIMALS]
dog
cat
rabbit
snake
[FRUITS]
apple
orange
mango
pineapple
[BUILDINGS]
shed
garage
house
mansion
[VEHICLES]
bike
motor bike
car
truck
The program loads the file and uses Split to separate the sections. It then uses Split again to separate the lines in each section and adds the lines to different ListBoxes.
See also Copy the lines in a file into a ListBox.
Also note that XML files make a natural way to store this kind of information. For information on using XML in VB .NET, see the book Visual Basic .NET and XML. For information on using XML with VB 6, see the article Getting Started with VB 6 and XML.
|