|
-
Jan 30th, 2001, 07:32 AM
#1
Thread Starter
Addicted Member
Dear friends,
I wish to ask how to code with the progress control. You know when downloading a file from the Web using IE or copying files using File Manager, it will show the progress.
But how can I determine when the job is over? For example, I use ADO to update a large database. Then what parameters I should know to show this progress.
-
Jan 30th, 2001, 07:50 AM
#2
Fanatic Member
The following code will update a progress bar while moving through an ADO recordset. I used the SLEEP API to allow the progress to be seen, otherwise it would just fly through.
In order for a progressBar to work, you will need to know the number of records in the recordSet to set the maximum value for the progressBar. Set it with the recordcount value.
Code:
Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Private Sub Command1_Click()
ProgressBar1.Min = 1
ProgressBar1.Max = rs.RecordCount
rs.MoveFirst
Dim x As Integer
For x = 1 To ProgressBar1.Max
ProgressBar1.Value = x
Sleep 100
rs.MoveNext
Next x
End Sub
Private Sub Form_Load()
Set cnn = New ADODB.Connection
Set rs = New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Program Files\Microsoft Visual Studio\VB98\Nwind.mdb;" & _
"Persist Security Info=False"
rs.Open "Select * from Customers", cnn, adOpenKeyset, adLockOptimistic
End Sub
-
Jan 30th, 2001, 12:15 PM
#3
Hyperactive Member
jbart is right
and what i do sometimes is if i know the time it will
take to finish an action (such as downloading a file),
i will use timer events every second to update the
progress bar until the max (value for each second in
the download) is reached
Bababooey
Tatatoothy
Mamamonkey
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|