Results 1 to 6 of 6

Thread: ProgressBar help needed

  1. #1

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    ProgressBar help needed

    Hi Guys,

    I need to show a progressbar while the following sub is being executed:

    The progressbar will be on another form and it should show while the sub is being executed and once the sub has executed, it must dissappear.

    I tried doing it but the progressbar wasn't showing any progress. I've deleted what I tried.

    Could someone please modify the following code to include the progressbar.

    Code:
    Private Sub cboSite_Click()
    
    On Error GoTo errh
    
    cmdPrintSiteInfo.Enabled = False
    SiteNum = cboSite.ItemData(cboSite.ListIndex)
    
    Call LoadSite(SiteNum)
    LoadConsumable (SiteNum)
    Call LoadSiteInfo("({Command.SiteId} = " & SiteNum & ")")
    
    cboNotes.Enabled = True
    
    Call PopulateNoteCombos(SiteNum)
    
    
    'Unload Form3
    NewRecNote = False
    NewNote = False
    cmdPrintSiteInfo.Enabled = True
    
    Exit Sub
        
    errh:
        errmsg "The following Exception occured : " & ERR.Description & ",  " & ERR.Source & "", "Exception occured in frmItemManager.cboSite_Click()"
    
    
    End Sub
    Last edited by Nitesh; Dec 4th, 2007 at 09:21 AM. Reason: removing error

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: ProgressBar help needed

    You have a Loop call in there without any Do Until call.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    Re: ProgressBar help needed

    Quote Originally Posted by RobDog888
    You have a Loop call in there without any Do Until call.
    sorry, forgot to remove that. that was the remains of the code I tried. Will remove it now.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: ProgressBar help needed

    Ok, so between the two cmdPrintSiteInfo.Enabled lines is what your processing and would like a progressbar to show?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    Re: ProgressBar help needed

    yes, that's right

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: ProgressBar help needed

    Then its not going to be possible to get an accurate representation as some functions will take longer then others.

    Try...

    Code:
    cmdPrintSiteInfo.Enabled = False
    Progressbar1.Min = 0
    Progressbar1.Max = 60
    Progressbar1.Value = 0
    SiteNum = cboSite.ItemData(cboSite.ListIndex)
    Progressbar1.Value = 10
    Call LoadSite(SiteNum)
    Progressbar1.Value = 20
    LoadConsumable (SiteNum)
    Progressbar1.Value = 30
    Call LoadSiteInfo("({Command.SiteId} = " & SiteNum & ")")
    
    Progressbar1.Value = 40
    cboNotes.Enabled = True
    
    Progressbar1.Value = 50
    Call PopulateNoteCombos(SiteNum)
    
    'Unload Form3
    Progressbar1.Value = 60
    NewRecNote = False
    NewNote = False
    cmdPrintSiteInfo.Enabled = True
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width