Copying multiple files ( help )
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Hello all, i just need little help and hope someone will help me 
I know how to copy a single file to another location like this:
If I had a Listbox with files locations like this
Thanks

I know how to copy a single file to another location like this:
Code: Select all
Ok, now what about if i wanted to copy ( Multiple ) files together? my.computer.filesystem.copyfile("file location", "new folder location")
If I had a Listbox with files locations like this
C:/file.exeI want to copy them all to the new location how?
C:/text.txt
C:/pic.jpg
Thanks
Edit:
I also want to have a progress bar, which moves to 100% when copying the files
thannks!
I also want to have a progress bar, which moves to 100% when copying the files

thannks!
I tried this and it seems to work
C:\Users\josh\Users.txt
C:\Users\josh\Text.txt
C:\Users\josh\Mail.txt
And this is what the program looks like
![Image]()
Hope it works for you
Code: Select all
these are the items in my listbox Imports System.IO
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
ProgressBar1.Maximum = ListBox1.Items.Count
For i As Integer = 0 To ListBox1.Items.Count - 1
Dim thestrings() As String = ListBox1.Items(i).ToString.Split("\")
Dim filename As String = thestrings(thestrings.Count - 1)
FileCopy(ListBox1.Items(i), "C:\Test\" & filename)
ProgressBar1.Value += i
Next
End Sub
End Class
C:\Users\josh\Users.txt
C:\Users\josh\Text.txt
C:\Users\josh\Mail.txt
And this is what the program looks like

Hope it works for you

Thanks for the help i will try this now and tell you if it worked or not 
Thanks hehaho;

Thanks hehaho;
It tells me count is not a member of system.array
help please
in this code
EDIT: And I wanted it to paste the files? will this paste files? i mean copy and paste like moving file.
Thanks
help please
in this code
Code: Select all
plees help(thestrings.Count
EDIT: And I wanted it to paste the files? will this paste files? i mean copy and paste like moving file.
Thanks
Last edited by CodenBoy on Sun Jul 15, 2012 5:30 pm, edited 1 time in total.
Actually thanks but im so sorry idk what i wanted..
i just wanted to move multiple files from listbox but its like copy + paste
it keeps the file just copy, paste it in other directory
:o can u give me this codes :o
Bogoh7 if you got skype tell me so we can talk fast
Thaanks
i just wanted to move multiple files from listbox but its like copy + paste
it keeps the file just copy, paste it in other directory
:o can u give me this codes :o
Bogoh7 if you got skype tell me so we can talk fast
Thaanks
Wait, are you saying you want it to copy/paste the file, or move it entirely?
Sorry for being noob but thanks for bogoh7 and what i want is
Im making a program in vb 2010 express and what i want is i want to make a backup of a file to another location. so it will keep the file but just Copy,paste it to another location.
Im using a Listbox ( with file names in lines ) and i want progress bar to move while im copying the files or backing up.
Thanks ( sorry for my bad english ) loove;
Im making a program in vb 2010 express and what i want is i want to make a backup of a file to another location. so it will keep the file but just Copy,paste it to another location.
Im using a Listbox ( with file names in lines ) and i want progress bar to move while im copying the files or backing up.
Thanks ( sorry for my bad english ) loove;
Do you mean hotkeys copy and paste? if you want this you can use
It does copy files from one place to another, but the files have to already exist.
by the way i made some slight code changes
Unfortunantly i got rid of my skype account for i do not use it anymore
Code: Select all
If you want program copy & paste this is probably what you should useMy.Computer.clipboard
It does copy files from one place to another, but the files have to already exist.
by the way i made some slight code changes
Code: Select all
if this isn't what you mean, examples? ProgressBar1.Maximum = ListBox1.Items.Count
For i As Integer = 0 To ListBox1.Items.Count - 1
Dim thestrings() As String = ListBox1.Items(i).ToString.Split("\")
Dim filename As String = thestrings(thestrings.Length - 1)
FileCopy(ListBox1.Items(i), "C:\Test\" & filename)
ProgressBar1.Value = i + 1
Next
MsgBox("File Completed Copying", MsgBoxStyle.Information, "Done!")
Unfortunantly i got rid of my skype account for i do not use it anymore
Copyright Information
Copyright © Codenstuff.com 2020 - 2023