Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8864217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:11:17+00:00 2026-06-14T16:11:17+00:00

When my application starts, and it has just been upgraded, I am doing a

  • 0

When my application starts, and it has just been upgraded, I am doing a local database update (sqlite).

It is like that:
The user starts my app, and then I start the upgrade process.
During this upgrade process I am showing a form that has a continuous progressbar.
This form closes when the upgrade process is done and the user can then start using my application.

But the progressbar won’t animate since the upgrade process is so intensive.

In my old VB6 version I used an ActiveX-Exe that has 1 form and shows a progressbar. This was my “background worker”.

I am not sure if I can use the same approach in VB.NET.

I have only seen examples that then do the work in the background worker, but I have not seen any examples where the progressbar itself was the background worker.

The database upgrade needs to be blocking, the user may NOT use my application before the database upgrade was done. This means that only the progressbar should “out of process”, but not the upgrading.

Thank you very much!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T16:11:18+00:00Added an answer on June 14, 2026 at 4:11 pm

    First read this: Use of Application.DoEvents()

    So after reading the above answer you will never using DoEvents ever again, and without the DoEvents (and/or Invalidating the ProgressBar so its Paint event will fire) the "progressbar won’t animate since the upgrade process is so intensive"

    Hence Cthulhu’s comment – "You can make a dialog with a progressbar, make that dialog modal and execute your db-stuff on a backgroundworker." is one of the best ways forward.

    I have translated a C# implementation of this that I use, you should be able to drop it straight in.

    This is the ProgressBar Form:

    Public Partial Class ThinkingProgressBar
        Inherits Form
        Private startTime As System.DateTime = DateTime.Now
        Public Sub New()
            InitializeComponent()
        End Sub
    
        Private Sub lblClose_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs)
            Me.Tag = "Cancelled"
            Me.Hide()
        End Sub
    
        Public Sub SetThinkingBar(ByVal switchedOn As Boolean)
            If switchedOn Then
                lblTime.Text = "0:00:00"
                startTime = DateTime.Now
                Timer1.Enabled = True
                Timer1.Start()
            Else
                Timer1.Enabled = False
                Timer1.Stop()
            End If
        End Sub
    
        Private Sub timer1_Tick(sender As Object, e As EventArgs)
            Dim diff As New TimeSpan()
            diff = DateTime.Now.Subtract(startTime)
            lblTime.Text = diff.Hours & ":" & diff.Minutes.ToString("00") & ":" & diff.Seconds.ToString("00")
            lblTime.Invalidate()
        End Sub
    End Class
    

    Drag/Drop a BackgroundWorker control onto the form, here are the background worker events:

    Private Sub backgroundWorker1_DoWork(sender As Object, e As DoWorkEventArgs) Handles BackgroundWorker1.DoWork
        e.Result = e.Argument
        'DirectCast(e.Result, ThinkingProgressBar).SetThinkingBar(True) 
        'DO LONG OPERATION HERE
        
    End Sub
    
    Private Sub backgroundWorker1_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted
        Dim dlg As ThinkingProgressBar = TryCast(e.Result, ThinkingProgressBar)
        If IsNothing(dlg) = False Then
            dlg.SetThinkingBar(False)
            dlg.Close()
        End If
    End Sub
    

    And here is the calling code for when your application starts and does the upgrading:

    Dim dlg As New ThinkingProgressBar()
    dlg.SetThinkingBar(True)
    BackgroundWorker1.RunWorkerAsync(dlg)
    dlg.ShowDialog()
    If IsNothing(dlg.Tag) = False AndAlso dlg.Tag.ToString() = "Cancelled" Then
        Return
    End If
    

    A couple of things, you may prevent the user from Cancelling (ie lblClose_LinkClicked) and put in protective/defensive programming to handle cases where the user kills the process or turns off their PC during the upgrade.

    And the ProgressBar is actually an animated gif – and this will suit your usage because estimating the time it takes to update a database is very hard to predict:

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It seems that when a WPF application starts, nothing has focus. This is really
We've been developing an application that has a drop down dashboard that allows the
I have an ASP.Net MVC3 application that has been running fine in the default
My website has a setup whereby when the application starts a module called SiteContent
My application has one activity which starts two services but does not bind them.
I've written a Autoit script that starts a GUI application, when the application starts
I have couple resource DLLs that I currently load when application starts using following
I have been writing a small java application (my first!), that does only a
I have a User object/mapping in my application. Each user has a list of
I've been working with a codebase of a company that has a policy of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.