copy multiples files using threading

Garry

New member
Joined
Aug 13, 2012
Messages
1
Programming Experience
Beginner
i am trying to copy to pendrive.

first i am showing a list of file and user clicks to select the files he wants and the selected file(s) get added to listview.

one user select the file(s) he wants and listview is populated he click the btnCopy.

if the user selects single file then this codes works fine. but if user selects more than 1 file there is a error.

for copying i am using threading.

so can some one help me in copying multiple files(all the selected files by the user.)

VB.NET:
Private Sub btnCopy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCopy.Click

        DoWork1()

    End Sub

VB.NET:
#Region "Thread To Copy Files"

    Class TasksClass
        

        Friend SourceFilePath As String
        Friend DriveLetterForDestination As String
        Friend VideoClipNameWithFileExtensionFrmDB As String


        Sub DoCopying()
            My.Computer.FileSystem.CopyFile(SourceFilePath, DriveLetterForDestination & VideoClipNameWithFileExtensionFrmDB, True)
            MsgBox("Done")
        End Sub
    End Class

    Sub DoWork1()
        Dim Tasks As New TasksClass()
        Dim Thread1 As New System.Threading.Thread( _
            AddressOf Tasks.DoCopying)

        Tasks.SourceFilePath = VideoFilePathFrmDB
        Tasks.DriveLetterForDestination = DriveLetterForDestination
        Tasks.VideoClipNameWithFileExtensionFrmDB = VideoClipNameWithFileExtensionFrmDB

        Thread1.Start()

    End Sub


#End Region
 
if user selects more than 1 file there is a error.

so, you decided not to mention the error message because...


also, your code doesnt contain any reference to a list box, so the bit you posted is likely irrelevant - i'd expect to see a loop or an array if youre dealing with multiple things
 
Back
Top