hi!
Just playing around with the progress bar trying to figure it out.. doesnt seem as simple as VB6.
I have this code:
in theory the progress bar should step up 1 after each file is copiedbut the progress bar seems to hit 100% before the files have even finished copying.
some code such as "string.format" may seem un-needed for the task but i'm using it just to learn.
Just playing around with the progress bar trying to figure it out.. doesnt seem as simple as VB6.
I have this code:
VB.NET:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim dirinfo As New DirectoryInfo("C:\WINDOWS.0\system32\")
Dim i As Integer = 0
For Each fi In dirinfo.GetFiles
i += 1
Proc.Maximum = i
ListBox1.Items.Add(fi.Name.ToString)
File.Copy(String.Format("C:\WINDOWS.0\system32\{0}", fi.Name.ToString), _
String.Format("C:\temp\{0}", fi.Name.ToString))
If Proc.Value < Proc.Maximum Then
Proc.Value += 1
End If
Next
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Proc.Minimum = 0
Proc.Step = 1
Proc.Value = 0
End Sub
in theory the progress bar should step up 1 after each file is copiedbut the progress bar seems to hit 100% before the files have even finished copying.
some code such as "string.format" may seem un-needed for the task but i'm using it just to learn.