of1 = Openfiledialog's name
lstaccounts = list box you wish to have items added to
Put this code in the open button...Code:of1.InitialDirectory = "C:/" of1.FileName = "accounts.txt" of1.Title = "Open Accounts List..." of1.Filter = ("text files (*.txt) | *.txt") of1.ShowDialog() Dim r As IO.StreamReader r = New IO.StreamReader(of1.FileName) While (r.Peek() > -1) lstaccounts.Items.Add(r.ReadLine) End While r.Close()
Results 1 to 1 of 1
- 21 Feb. 2010 11:10pm #1
[VB.NET] Open txt file into a listbox