Hi!
Hab ein kleines Problem, und zwar folgendes:
(Hab mal grad die Codes hier eingefügr::)
/// Der Button
/// ProgressBar
-------------------------------------------------
Irgendwie funktioniert der Progessbar nicht (Der CopyWithProgessBar)
------
Wie man feststellen kann\sollte werden in einem bestimmten Verzeichniss, alle Dateien ermittelt, die dann in einem anderen Fenster (Log) wiedergegeben werden.
1. ProgressBar ist für die Vorbereitung
2. ProgressBar ist für den Ermittlungsvorgang, der im Hauptfenster angezeigt werden sollte, aber das funktioniert irgendwie nicht.
------
Weiß jemand Rat ???
Mfg.
Hab ein kleines Problem, und zwar folgendes:
(Hab mal grad die Codes hier eingefügr::)
/// Der Button
VB.NET-Quellcode
- Private Sub Button19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button19.Click
- ProgressBar1.Visible = True
- ProgressBar1.Value = 10
- System.Threading.Thread.Sleep(20)
- Log.ListBox1.Items.Clear()
- ProgressBar1.Value = 20
- System.Threading.Thread.Sleep(20)
- Log.TextBox1.Clear()
- ProgressBar1.Value = 30
- System.Threading.Thread.Sleep(20)
- Dim counter As _
- System.Collections.ObjectModel.ReadOnlyCollection(Of String)
- counter = My.Computer.FileSystem.GetFiles( _
- ("C:\TEST\"), _
- FileIO.SearchOption.SearchAllSubDirectories)
- ProgressBar1.Value = 60
- System.Threading.Thread.Sleep(20)
- Log.TextBox1.Text = (CUInt(counter.Count) & (" Gefundene Dateien"))
- ProgressBar1.Value = 70
- System.Threading.Thread.Sleep(20)
- For Each foundFile As String In My.Computer.FileSystem.GetFiles( _
- ("C:\TEST\"), _
- FileIO.SearchOption.SearchAllSubDirectories, "*.*")
- ProgressBar1.Value = 80
- System.Threading.Thread.Sleep(20)
- Log.ListBox1.Items.Add(foundFile)
- ProgressBar1.Value = 90
- System.Threading.Thread.Sleep(20)
- ProgressBar1.Value = 90
- System.Threading.Thread.Sleep(20)
- ProgressBar1.Visible = False
- Next
- CopyWithProgress()
- Application.DoEvents()
- Log.ShowDialog()
- End Sub
/// ProgressBar
VB.NET-Quellcode
- Private Sub CopyWithProgress(ByVal ParamArray filenames As String())
- ' Display the ProgressBar control.
- ProgressBar1.Visible = True
- Application.DoEvents()
- ' Set Minimum to 1 to represent the first file being copied.
- ProgressBar1.Minimum = 1
- Application.DoEvents()
- ' Set Maximum to the total number of files to copy.
- ProgressBar1.Maximum = ("C:\WINDOWS\Temp\").Length
- Application.DoEvents()
- ' Set the initial value of the ProgressBar.
- ProgressBar1.Value = 1
- Application.DoEvents()
- ' Set the Step property to a value of 1 to represent each file being copied.
- ProgressBar1.Step = 1
- Application.DoEvents()
- ' Loop through all files to copy.
- Dim x As Integer
- Application.DoEvents()
- For x = 1 To filenames.Length - 1
- Application.DoEvents()
- ' Copy the file and increment the ProgressBar if successful.
- Next x
- End Sub
-------------------------------------------------
Irgendwie funktioniert der Progessbar nicht (Der CopyWithProgessBar)
------
Wie man feststellen kann\sollte werden in einem bestimmten Verzeichniss, alle Dateien ermittelt, die dann in einem anderen Fenster (Log) wiedergegeben werden.
1. ProgressBar ist für die Vorbereitung
2. ProgressBar ist für den Ermittlungsvorgang, der im Hauptfenster angezeigt werden sollte, aber das funktioniert irgendwie nicht.
------
Weiß jemand Rat ???
Mfg.