alicelknight
asked on
Easy Progress Bar Question
Hi All!
Having problems refreshing the progress bar on a separate form. How can I make the form appear then disappear with the pb in the proper place and not appear to be off the form?
Here is part of my code...
Private Sub cmdSendEMail_Click()
Dim iRow As Integer
Dim ctr As Integer
Dim i As Integer
On Error GoTo PROC_ERR
ctr = 0
i = 0
For iRow = 0 To fgShip.Rows - 1
If fgShip.Cell(flexcpChecked, iRow, 0) = flexChecked Then
ctr = ctr + 1
End If
Next iRow
If ctr = 0 Then Exit Sub
frmPBEMail.Show
'frmPBEMail.Refresh
frmPBEMail.ProgressBar1.Va lue = 0
'frmPBEMail.ProgressBar1.R efresh
frmPBEMail.ProgressBar1.Ma x = ctr
'ProgressBar1.Max = ctr
i = 0
.......................... .........
.......................... ....
For iRow = 0 To fgShip.Rows - 1
If fgShip.Cell(flexcpChecked, iRow, 0) = flexChecked Then
i = i + 1
frmPBEMail.Label2.Caption = "Notification " & i & " of " & ctr & " Being Sent..."
frmPBEMail.Refresh
frmAuctionCorr.txtTo.text = Trim(fgShip.TextMatrix(iRo w, 16))
frmAuctionCorr.Get_NoteVar iables (fgShip.TextMatrix(iRow, 2))
frmAuctionCorr.cmdSend_Cli ck
frmPBEMail.ProgressBar1.Va lue = i
frmPBEMail.Refresh
End If
Next iRow
Unload frmAuctionCorr
Unload frmPBEMail
mbolEditing = False
Exit Sub
PROC_ERR:
..................
End Sub
In frmPBEMail I have Me.Refresh in Form_Load()
Thanks!
Having problems refreshing the progress bar on a separate form. How can I make the form appear then disappear with the pb in the proper place and not appear to be off the form?
Here is part of my code...
Private Sub cmdSendEMail_Click()
Dim iRow As Integer
Dim ctr As Integer
Dim i As Integer
On Error GoTo PROC_ERR
ctr = 0
i = 0
For iRow = 0 To fgShip.Rows - 1
If fgShip.Cell(flexcpChecked,
ctr = ctr + 1
End If
Next iRow
If ctr = 0 Then Exit Sub
frmPBEMail.Show
'frmPBEMail.Refresh
frmPBEMail.ProgressBar1.Va
'frmPBEMail.ProgressBar1.R
frmPBEMail.ProgressBar1.Ma
'ProgressBar1.Max = ctr
i = 0
..........................
..........................
For iRow = 0 To fgShip.Rows - 1
If fgShip.Cell(flexcpChecked,
i = i + 1
frmPBEMail.Label2.Caption = "Notification " & i & " of " & ctr & " Being Sent..."
frmPBEMail.Refresh
frmAuctionCorr.txtTo.text = Trim(fgShip.TextMatrix(iRo
frmAuctionCorr.Get_NoteVar
frmAuctionCorr.cmdSend_Cli
frmPBEMail.ProgressBar1.Va
frmPBEMail.Refresh
End If
Next iRow
Unload frmAuctionCorr
Unload frmPBEMail
mbolEditing = False
Exit Sub
PROC_ERR:
..................
End Sub
In frmPBEMail I have Me.Refresh in Form_Load()
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
As ryancys said.. the DoEvents will allow frmPBEMail the opportunity to repaint the screen. To move frmPBEMail to the top of the application.. you may want to show it as Modal.
ASKER
Thanks all for your help. But why is the pb form now minimized in my tray? I want it to show on top of the form that's currently open.
ASKER
PBuck:
Thanks, it was a problem with the refreshes. Also, it's minimized in my tray because of it being a MDI child form. I set the borderstyle to fixed single and all seems to work fine.
Everyone: Thanks for your help. It was a combination of all but the mention of the MDI child form got me on the right track and not using so many refreshes. Thanks all for your help!
Thanks, it was a problem with the refreshes. Also, it's minimized in my tray because of it being a MDI child form. I set the borderstyle to fixed single and all seems to work fine.
Everyone: Thanks for your help. It was a combination of all but the mention of the MDI child form got me on the right track and not using so many refreshes. Thanks all for your help!
Excellent@! Glad things got working for you - I always disliked some of the 'actions' from using MDI child forms :-)
Donno actualy on your question, but
To be more effective, use DoEvents after the progressbar.value + 1 ..
regards.