by Brandon (46 Submissions)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 7th October 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
reads data from an input file and adds it to a combo list box.
'put a combo box on your form.
'create a file named ItemFile.txt in My Documents on your computer.
'in your input file, enter this data:
"Kitchens"
"Hallways"
"Bedrooms"
"Bathrooms"
"Garage"
'execute the program and now you should have these items in your
'combo list box that were in your text file.
Public Function AddListItems(udtItem As String)
'this function will read data from an input
'file and assign the data to a combo list box
'open input file
Open "c:\My Documents\ItemFile.txt" For Input As #1
Do While Not EOF(1)
Input #1, udtItem
Combo1.AddItem (udtItem)
Loop
End Function
Private Sub Form_Load()
Combo1.Text = "Household"
End Sub
Private Sub mnuAddItems_Click()
'call function
AddListItems (AllItems)
End Sub