As in the Title, i want to have a progressbar, which is showing the process while copying.
My code so far:
Imports System.IO Imports Scripting
Public Class Form1 Dim Source, Destination As String Dim fso As FileSystemObject = New FileSystemObject Dim SourceSize As Double
Private Sub ResetThings()
ProgressBar1.Value = 0
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim xFilesCount = Directory.GetFiles(Source).Length
Dim xFilesTransferred As Integer = 0
For Each xFiles In Directory.GetFiles(Source)
My.Computer.FileSystem.CopyDirectory(Source, Destination, True)
xFilesTransferred += 1
ProgressBar1.Value = xFilesTransferred * 100 / xFilesCount
ProgressBar1.Update()
Next
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs)
End Sub
Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs)
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
FolderBrowserDialog1.ShowDialog()
Source = FolderBrowserDialog1.SelectedPath
first.Text = "Original: " & Source
ResetThings()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
FolderBrowserDialog1.ShowDialog()
Destination = FolderBrowserDialog1.SelectedPath
Dim Temp = Source
Do
Temp = Temp.Substring(1)
Loop Until Temp.Contains("\") = False
Destination = Destination
Second.Text = "Ziel: " & Destination
End Sub
ProgressBar1.Maximum. and then you can use this lineProgressBar1.Increment(1)to make it go up by one after every file. and because you have set a maximum, once all files are done the progress bar should be complete - Cal-cium