ProgressBar question

S

Steve

Hi,

I have a function that copys a file, and I would like to use a ProgressBar, but i can't find a good example anywhere. The one in the help files uses a copy function that returns a value. Maybe if I knew how to do that........Anyway, any help is appreciated.

Steve


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim srcPath, destPath, dirvar As String
srcPath = Application.StartupPath & "\punch.MDB"
destPath = "c:\_Test\punch.mdb"
dirvar = "c:\_Test"
Try
If Directory.Exists(dirvar) Then
File.Copy(srcPath, destPath)
Else
Directory.CreateDirectory(dirvar)
File.Copy(srcPath, destPath)
End If

Catch ex As Exception

End Try
End Sub
 
C

Cor

Hi Steve

In this function you cannot use a progresbar.
The only thing you could do is show a "busy" text before and change that
with a "ready" text (or use icons, gifs whatever)..

There is no interaction in your program in those statements you use.
It starts and goes to the next program instruction only when it is ready or
throws an error.

I hope this helps anyway.

Cor


I have a function that copys a file, and I would like to use a ProgressBar,
but i can't find a good example anywhere. The one in the help files uses a
copy function that returns a value. Maybe if I knew how to do
that........Anyway, any help is appreciated.

Steve


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim srcPath, destPath, dirvar As String
srcPath = Application.StartupPath & "\punch.MDB"
destPath = "c:\_Test\punch.mdb"
dirvar = "c:\_Test"
Try
If Directory.Exists(dirvar) Then
File.Copy(srcPath, destPath)
Else
Directory.CreateDirectory(dirvar)
File.Copy(srcPath, destPath)
End If

Catch ex As Exception

End Try
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top