Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Only filenames in Listbox, and want to save all item to another folder

VB
Dim files() As String
files = Directory.GetFiles("C:\", "*.txt")

Dim file As String
For Each file In files
lstFiles.Items.Add(Path.GetFileName(file))
Next


output :
00001.txt
00003.txt
00005.txt ....

want to save the content of a ListBox to another folder.
Posted
Updated 20-Oct-13 0:45am
v2
Comments
Sergey Alexandrovich Kryukov 23-Oct-13 19:24pm    
Please stop re-posting questions which were automatically removed for abuse. It probably happened because you provided virtually no information.
Instead, as question in essential detail, accurately.
—SA

1 solution

Try:
VB
File.WriteAllLines("D:\Temp\MyListBoxContent.txt", lstFiles)


But do be aware that if this is really VB.NET, then the list of files and the save location will both be on the Server, not the Client: VB code is executed at the server, and cannot access Client disks.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900