Solved

Easy Progress Bar Question

Posted on 2001-08-23
6
304 Views
Last Modified: 2012-05-04
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.Value = 0
    'frmPBEMail.ProgressBar1.Refresh
    frmPBEMail.ProgressBar1.Max = 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(iRow, 16))
            frmAuctionCorr.Get_NoteVariables (fgShip.TextMatrix(iRow, 2))
            frmAuctionCorr.cmdSend_Click
            frmPBEMail.ProgressBar1.Value = 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!
0
Comment
Question by:alicelknight
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 4

Accepted Solution

by:
PBuck earned 50 total points
ID: 6417633
I would suggest and say not to use the ProgressBar1.Refresh - I don't think that is necessary when you are setting up the progress bar.  But why it is moving off the screen ... I don't see any code here that would move it.

Are you using MDI child forms?  For testing, why not set the Top, Left params.  Such as;

ProgressBar1.left = 200
ProgressBar1.top = 200
ProgressBar1.min = 0
ProgressBar1.max = ctr

*note .. if you are using form refreshes because you are not see movement - make sure your form autoredraw is set to true (then you may not need the refresh statements).

Hope this helps!
0
 
LVL 51

Expert Comment

by:Ryan Chong
ID: 6417673
Hi aliceknight,

Donno actualy on your question, but

To be more effective, use DoEvents after the progressbar.value + 1 ..

regards.
0
 
LVL 14

Expert Comment

by:wsh2
ID: 6417701
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.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:alicelknight
ID: 6418573
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.
0
 

Author Comment

by:alicelknight
ID: 6418924
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!
0
 
LVL 4

Expert Comment

by:PBuck
ID: 6419026
Excellent@!  Glad things got working for you - I always disliked some of the 'actions' from using MDI child forms  :-)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question