Populate combobox with data in a text file
I have a text file with a list of names that I want to populate into a combo box. Below is the code I am trying. It works for a text box, but I get errors when I try it with a combo box. Am I taking the correct approach?
Code:
Private Sub Form_Load()
'Outline: - Asks the user for a file.
' - Reads all the data into Text1.
Dim FilePath As String
Dim Data As String
FilePath = InputBox("Enter the path for a text file", "The Two R's", _
"C:\users.TXT")
'Asks the user for some input via an input box.
Open FilePath For Input As #1
'Opens the file given by the user.
Do Until EOF(1)
'Does this loop until End Of File(EOF) for file number 1.
Line Input #1, Data
'Read one line and puts it into the varible Data.
Combo11.Text = Combo11.Text & vbCrLf & Data
'Adds the read line into Text1.
MsgBox EOF(1)
Loop
Close #1
'Closes this file.