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
these are the items in my listbox
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
Re: Copying multiple files ( help )
Posted: Sun Jul 15, 2012 5:20 pm
by CodenBoy
Thanks for the help i will try this now and tell you if it worked or not
Thanks hehaho;
Re: Copying multiple files ( help )
Posted: Sun Jul 15, 2012 5:24 pm
by CodenBoy
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
Re: Copying multiple files ( help )
Posted: Sun Jul 15, 2012 5:27 pm
by Bogoh67
maybe try changing it to thestrings.length
Re: Copying multiple files ( help )
Posted: Sun Jul 15, 2012 5:37 pm
by CodenBoy
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
Re: Copying multiple files ( help )
Posted: Sun Jul 15, 2012 5:57 pm
by comathi
Wait, are you saying you want it to copy/paste the file, or move it entirely?
Re: Copying multiple files ( help )
Posted: Sun Jul 15, 2012 6:00 pm
by CodenBoy
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;
Re: Copying multiple files ( help )
Posted: Sun Jul 15, 2012 6:08 pm
by Bogoh67
Do you mean hotkeys copy and paste? if you want this you can use
If you want program copy & paste this is probably what you should use
It does copy files from one place to another, but the files have to already exist.
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!")
if this isn't what you mean, examples?
Unfortunantly i got rid of my skype account for i do not use it anymore