Solved

Easy Progress Bar Question

Posted on 2001-08-23
6
308 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 52

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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

688 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