nsacr.blogg.se

Vb net update progress bar backgroundworker thread up
Vb net update progress bar backgroundworker thread up








vb net update progress bar backgroundworker thread up vb net update progress bar backgroundworker thread up

Reports progress and cancelation are both set to True in the properties. This is the code for this section, as of now the BackgroundWorker is "empty" Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As ) Handles BackgroundWorker1.DoWork 'Change bolAbort to True to keep the process from continuing If MessageBox.Show("Check to make sure the Drive is there!", "Error Message", MessageBoxButtons.Retr圜ancel, MessageBoxIcon.Error) = Then 'Folder already exists, exiting Sub to continue with possible file copyĭirectory.CreateDirectory(DestinationPath + strFolder) If (Directory.Exists(DestinationPath + "\" + strFolder)) Then Public Sub CopyDirectory(ByVal sourcePath As String, ByVal strFolder As String, ByVal DestinationPath As String) Private Sub CopyFiles(ByVal sourcePath As String, ByVal strFolder As String, ByVal DestinationPath As String)įor Each fName As String In Directory.GetFiles(sourcePath + "\" + strFolder)ĭFilePath = DestinationPath + strFolder + "\" + dFile ' Tell the Background Worker to stop working. If BackgroundWorker1.WorkerSupportsCancellation Then SourcePath = "C:\Documents and Settings\Derek\My Documents\Visual Studio 2005\Projects" Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click MessageBox.Show("File Copy has completed!", "File Backup", MessageBoxButtons.OK, MessageBoxIcon.Information) 'If bolAbort = True then exit from the sub StrFolder = strDirectory.Substring(sourcePath.Length + 1)ĬopyDirectory(sourcePath, strFolder, DestinationPath)ĬopyFiles(sourcePath, strFolder, DestinationPath) 'Loop though each directory and copy all the files in themįor Each strDirectory In Directory.GetDirectories(sourcePath, "*", SearchOption.AllDirectories) Public Sub FileBackup(ByVal sourcePath As String, ByVal DestinationPath As String)










Vb net update progress bar backgroundworker thread up