Hi everyone. I am having a problem reading the contents of a file into
a ComboBox. I end up with only the last item being read into the list.
Can someone show me what is wrong?
Thanks.
test.txt contents:
"1994 Ford F150 Pickup"
"1987 GMC 2500"
"1986 Hyundai Pony"
"1996 Honda Civic"
"1990 Pontiac Sunfire"
My Code is as follows:
Private Sub Form_Load()
Dim intRetVal As Integer
Dim strEntries As String
On Error GoTo FileError
Open "a:\test.txt" For Input As #1
Do Until EOF(1)
Input #1, strEntries
cboVehicle.Text = strEntries 'How can i add to the box?
Loop
Exit Sub
FileError:
If Err.Number = 71 Then
intRetVal = MsgBox("Disk Not Ready", vbExclamation + vbOKCancel, _
"File Access Error")
If intRetVal = vbCancel Then
Unload Me
Else
Resume
End If
Else
Err.Raise Err.Number
End If
End Sub