Hello,
You may try the following Code. The code checks for the existence of a file when the application starts and then reads
each line into the Combo box.
BEGIN CODE
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If File.Exists("c:\source.txt") Then
Dim str As StreamReader
str =
New StreamReader("c:\source.txt")While Not str.EndOfStream
Me.ComboBox1.Items.Add(str.ReadLine)
End While
Else
MsgBox(
"File does not exists")
End IfEnd Sub
END CODEYou will also have to import the namespace 'IO' on the top using
Imports
System.IO
I believe this should help.
Regards,
Allen Smith
ComponentOne LLC
www.componentone.com