VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Save / Write contents of a listbox to a textfile

by Marcel Wijnands (3 Submissions)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (3 Votes)

Save /Write contents of a listbox to a textfile

Inputs
output filename and listbox name
Assumes
Usage: ListBox2File "c:\yourfile.txt", ListBox1

Rate Save / Write contents of a listbox to a textfile

Public Sub ListBox2File(sFile As String, oList As ListBox)
Dim fnum, x As Integer
Dim sTemp As String 
 fnum = FreeFile()
 x = 0
 Open sFile For Output As fnum
  While x <> oList.ListCount
   Print #fnum, oList.List(x)
   x = x + 1
  Wend
 Close fnum
End Sub
'Check out http://www.vb2delphi.com for more code!

Download this snippet    Add to My Saved Code

Save / Write contents of a listbox to a textfile Comments

No comments have been posted about Save / Write contents of a listbox to a textfile. Why not be the first to post a comment about Save / Write contents of a listbox to a textfile.

Post your comment

Subject:
Message:
0/1000 characters