Hallo, ich hab ein kleines Programm geschrieben, welches Dateien von einem Ordner inkl. Unterordner auf einen anderen Speicherplatz kopiert.
Weiters hab ich auch eine ProgressBar eingebaut, die mir den gesamten Kopierprozess anzeigt.
Was ich aber auch noch benötige und leider nicht hinbekomme ist, ich möchte eine 2. ProgressBar anzeigen, der mir die einzellnen Dateien durchläuft. Ich komm leider nicht dahinter
Hier die Subroutine des Kopiervorganges
Und das ist meine ProgressBar
Das funktioniert auch, nur möchte ich eben jede einzellne Datei auch mittels einer ProgressBar zusätzlich anzeigen lassen.
Kann mir hier bitte jemand helfen?
LG, Andi
*Topic verschoben*
Weiters hab ich auch eine ProgressBar eingebaut, die mir den gesamten Kopierprozess anzeigt.
Was ich aber auch noch benötige und leider nicht hinbekomme ist, ich möchte eine 2. ProgressBar anzeigen, der mir die einzellnen Dateien durchläuft. Ich komm leider nicht dahinter
Hier die Subroutine des Kopiervorganges
VB.NET-Quellcode
- Private Sub CopyFiles(ByVal folder As System.IO.DirectoryInfo, ByVal destinationFolder As String)
- If Not System.IO.Directory.Exists(destinationFolder) Then
- System.IO.Directory.CreateDirectory(destinationFolder)
- End If
- Dim files As String
- files = CStr(My.Computer.FileSystem.GetFiles(ROOTFOLDER, FileIO.SearchOption.SearchAllSubDirectories, "*.*").Count)
- For Each fi As System.IO.FileInfo In folder.GetFiles
- CopyFileEx(fi.FullName, destinationFolder & "\" & fi.Name, _copyProgressRoutine, 0, 0, 0)
- _totalBytesCopied += fi.Length
- Label3.Text = "Kopiere: " & fi.Name
- Next
- For Each di As System.IO.DirectoryInfo In folder.GetDirectories
- CopyFiles(di, di.FullName.Replace(ROOTFOLDER, DESTFOLDER))
- Next
- End Sub
Und das ist meine ProgressBar
VB.NET-Quellcode
- Private Function CopyProgress(ByVal totalFileSize As Int64, ByVal totalBytesTransferred As Int64, ByVal streamSize As Int64, ByVal streamBytesTransferred As Int64, ByVal dwStreamNumber As Int32, ByVal dwCallbackReason As Int32, ByVal hSourceFile As Int32, ByVal hDestinationFile As Int32, ByVal lpData As Int32) As Int32
- ProgressBar1.Value = Convert.ToInt32((_totalBytesCopied + totalBytesTransferred) / _totalFileSize * 100)
- Application.DoEvents()
- End Function
Das funktioniert auch, nur möchte ich eben jede einzellne Datei auch mittels einer ProgressBar zusätzlich anzeigen lassen.
Kann mir hier bitte jemand helfen?
LG, Andi
*Topic verschoben*
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Marcus Gräfe“ ()