Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleLoad data from a text file into ListBoxes
KeywordsListBox, text file, INI file
CategoriesControls, Files and Directories
 
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.

 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated