Hi,
da ich noch Anfäger bin in VB hab ich mir einen Dateisortierer gebastelt.
Nun, wird das Label " lbl_verbleibende_dateien" immer sofort auf 0 gesetzt und das Label "lbl_datei" ist immer "?". Wenn ich ne msgbox() vor "next" mache, dann wird alles perfekt angezeigt.
MfG Ludder231
da ich noch Anfäger bin in VB hab ich mir einen Dateisortierer gebastelt.
PHP Code:
Private Sub btn_move_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_sortieren.Click
Dim dateipfad As Array
Dim dateiname As Array
Dim anzahl_dateien As Integer
Dim count As Integer
If (fd_files.ShowDialog() = DialogResult.OK) Then ' wenn Openfile ein OK zurück gibt
If (fd_speicher_pfad.ShowDialog() = DialogResult.OK) Then ' wenn Openfile ein OK zurück gibt
dateipfad = fd_files.FileNames
dateiname = fd_files.SafeFileNames
anzahl_dateien = UBound(dateiname) + 1
lbl_anzahl_dateien.Text = anzahl_dateien
lbl_verbleibende_dateien.Text = anzahl_dateien
prgb_fortschritt.Maximum = anzahl_dateien
For I = 0 To anzahl_dateien - 1
count = (anzahl_dateien - 1) - I
lbl_datei.Text = dateiname(I)
If dateiname(I).contains(".mp4") Then
If chb_mp4.CheckState = CheckState.Checked Then
If Not My.Computer.FileSystem.DirectoryExists(fd_speicher_pfad.SelectedPath & "\mp4") Then
My.Computer.FileSystem.CreateDirectory(fd_speicher_pfad.SelectedPath & "\mp4")
End If
My.Computer.FileSystem.CopyFile(dateipfad(I), fd_speicher_pfad.SelectedPath & "\mp4\" & dateiname(I)) ' Kopieren
End If
ElseIf dateiname(I).contains(".txt") Then
If chb_txt.CheckState = CheckState.Checked Then
If Not My.Computer.FileSystem.DirectoryExists(fd_speicher_pfad.SelectedPath & "\txt") Then
My.Computer.FileSystem.CreateDirectory(fd_speicher_pfad.SelectedPath & "\txt")
End If
My.Computer.FileSystem.CopyFile(dateipfad(I), fd_speicher_pfad.SelectedPath & "\txt\" & dateiname(I)) ' Kopieren
End If
ElseIf dateiname(I).contains(".mp3") Then
If chb_mp3.CheckState = CheckState.Checked Then
If Not My.Computer.FileSystem.DirectoryExists(fd_speicher_pfad.SelectedPath & "\mp3") Then
My.Computer.FileSystem.CreateDirectory(fd_speicher_pfad.SelectedPath & "\mp3")
End If
My.Computer.FileSystem.CopyFile(dateipfad(I), fd_speicher_pfad.SelectedPath & "\mp3\" & dateiname(I)) ' Kopieren
End If
ElseIf dateiname(I).contains(".jpg") Or dateiname(I).contains(".png") Or dateiname(I).contains(".bmp") Then
If chb_pic.CheckState = CheckState.Checked Then
If Not My.Computer.FileSystem.DirectoryExists(fd_speicher_pfad.SelectedPath & "\pictures") Then
My.Computer.FileSystem.CreateDirectory(fd_speicher_pfad.SelectedPath & "\pictures")
End If
My.Computer.FileSystem.CopyFile(dateipfad(I), fd_speicher_pfad.SelectedPath & "\pictures\" & dateiname(I)) ' Kopieren
End If
End If
prgb_fortschritt.Value = I + 1
lbl_verbleibende_dateien.Text = count
Next
End If
End If
End Sub
Nun, wird das Label " lbl_verbleibende_dateien" immer sofort auf 0 gesetzt und das Label "lbl_datei" ist immer "?". Wenn ich ne msgbox() vor "next" mache, dann wird alles perfekt angezeigt.
MfG Ludder231