SF1 = SaveFileDialog's name
lstaccounts = List you want to export
Put this code in the save button...Code:sf1.InitialDirectory = "C:/" sf1.FileName = "Accounts.txt" sf1.Title = "Save Account List..." sf1.Filter = ("text files (*.txt) | *.txt") sf1.ShowDialog() Dim w As New IO.StreamWriter(sf1.FileName) Dim i As Integer For i = 0 To lstaccounts.Items.Count - 1 w.WriteLine(lstaccounts.Items(i).ToString) Next w.Close()
Results 1 to 1 of 1
- 21 Feb. 2010 11:06pm #1
[VB.NET] Save listbox to a .txt with SaveFileDialog
Last edited by Eternal Darkness; 27 Mar. 2010 at 05:38am.