i have all items from folder in listbox and add extra item how do i sa

0 Replies - 4999 Views - Last Post: 01 May 2008 - 04:52 AMRate Topic:

save listbox items to folder

Posted 01 May 2008 - 04:52 AM

i have all items from folder,mijn afspeellijsten\jaren 60 muziek(my playlists\year 60 music) in listbox1 and add extra item to the listbox1 from listview1.
how do i save/copy this added item to the folder mijn afspeellijsten\jaren 60 muziek true a button save? can anybody help me with some code!?

Private Sub btnFolder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFolder.Click
'name of folder
Dim strFolderName As String
''select a folder to check for mp3 files
'objDialog.strSelectFolderTitle = "Select Folder to Search for MP3s"
''get the folder name
' strFolderName = objDialog.fstrSelectFolder
'strFolderName = "C:\Documents and Settings\admin\Mijn documenten\Mijn muziek\Mijn afspeellijsten\MUZIEK\JAREN 60 MUZIEK"
strFolderName = System.Environment.GetFolderPath(typeSpecialFolder.MyMusic) + "\Mijn Afspeellijsten\JAREN 60 MUZIEK"
'check validity of folder,
If blnDoesFolderExist(strFolderName) = True Then
'clear any current values in the
'form controls
ClearValues()
'clear any current list contents
lstFiles.Items.Clear()
'put name into text box
txtFolder.Text = strFolderName
'scan folder/subfolders for mp3s
flngLoadList(strFolderName)
End If
[/code/]
[code] Private Function flngLoadList(ByVal strFolderName As String) As Long
'loads the file list with all mp3s found in the folder and subfolder
'selected by the user
'index variable for array(s)
Dim intIndex As Integer
'array to hold file names on each
'run of the function
Dim strFileName() As String
Dim strDirName() As String
'find the first file
strFileName = System.IO.Directory.GetFiles(strFolderName)
'get the list of directories
strDirName = System.IO.Directory.GetDirectories(strFolderName)
'enumerate through the files found, add any mp3 files
'to the list
For intIndex = 0 To (strFileName.Length - 1)
If strFileName(intIndex).EndsWith(".mp3") = True Then
lstFiles.Items.Add(strFileName(intIndex))
End If
Next
'enumerate through the list of directories
For intIndex = 0 To (strDirName.Length - 1)
If strDirName(intIndex).Substring(0) <> "." Then
flngLoadList(strAddSlash(strDirName(intIndex)))
End If
Next
End Function