1
Reply

help for a backgroundworker based project....

george

george

Apr 9 2010 5:23 PM
2.7k
hello,
in daily basis when i open my pc i have to copy and replace a folder to my program filles to play a game :) this copying process takes a long time to be completed so i wanted to make a backgroundworker based project with a progress bar and a label showing the completition of the copying progress(with button!!!).the source is "C:\Users\zaxos\Desktop\Metin2_GR" and the path to copy is "C:\Program Files\Metin2_GR"
this is my progress so far...

Public Class Form1
    Dim i As Integer = 0
    Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
        Do Until i = "100"
            If BackgroundWorker1.CancellationPending = True Then
                MsgBox("DONE")
                Exit Sub
            End If
            i = i + 1
            BackgroundWorker1.ReportProgress(0)
            System.Threading.Thread.Sleep(1)
        Loop
    End Sub

    Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        BackgroundWorker1.RunWorkerAsync()
        Timer1.Start()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        BackgroundWorker1.CancelAsync()
    End Sub

    Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick, ProgressBar1.Click
        Label1.Text = i
        ProgressBar1.Value = i
    End Sub
End Class

oh i forgot my projects are i vb....
if you copy this you'll understand that it has nothing to do with copying yet :P
so here is my problem....i dont know how to add that copying thing in the code.
anybody who can help me????



ps: sorry for my english i'm from greece.....

Answers (1)
Next Recommended Forum