Easy Listbox question......
I'm wanting to write the items in a listbox to a textfile. What's wrong with this line of code. I've been using Listview for so long, I forgot how to use Listbox! ;)
VB Code:
Print #l, lstCategories.Selected
I've already coded the looping part. Is it Lstcategories.index or what?
Getting some kind of ARRAY error!???
Here's what I'm using. It is in a module so it can be accessed by more than one form.
VB Code:
Public Sub WriteTextFile()
'Save the listbox entries to a text file
Dim l As Integer
Dim m As Integer
'get the next free file
l = FreeFile
Open "C:\Windows\System\categories.kmo" For Output As #l
'start the loop
For m = 1 To categories.lstCategories.ListCount
'add to the file every line from the listbox
Print #l, categories.lstCategories.Selected(m)
Next m
Close #l
End sub