Solved

Easy Progress Bar Question

Posted on 2001-08-23
6
296 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
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 49

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

919 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now