I have downloaded a Visual Basic 6 application which pick a random name from a list box. But I want the list box to already be filled with names from a text. What should I do? I have entirely no knowledge about Visual Basic and I am just watching tutorial from YouTube. I will just use this application so that I can randomly pick names on my online class. Thanks
How can I load text file into list box in Visual Basic 6
Collapse
X
-
Opening text file in vb6 requires a physical path to the file location.
This code can help you.
Code:Sub ReadFile(listBox1 As ListBox, filePath As String) Open filePath For Input As #dfile Dim txt As String Do While Not EOF(dfile) ' this will read all text to listbox Line Input #dfile, txt listBox1.Items.Add(txt) Loop Close #dfile End Sub
-
-
Comment