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

Fill A Combobox from a text file

Status
Not open for further replies.

Domino2006

Programmer
Jan 13, 2007
20
0
0
GB
Hi Guys and Gals

Im Trying to load the contents of a text file into a combobox, i have looked all over the net to no avail.

i have read the text file using a streamreader and assigned it to a string, i have used the string name as the datasource as follows

combobox1.datasource = stringname

it isnt a 1-dimensional array could this be the problem?


any help would be gr8 thanx in advance.

Domino2006
 
Hi Domino,

You want to add the lines from the file to the combo, right ?
 
If your file is one item per line then use something like:
Code:
Dim Lines() As String
Lines = Split(StreamReader.ReadToEnd, vbCrLf)
StreamReader.Close
combobox1.datasource = Lines
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top