Displaying a progressbar while executing an SQL Query

后端 未结 2 981
轮回少年
轮回少年 2020-12-10 13:40

I want to inform the user while data is being read from an SQL database and I decided to create a form with a progressbar but it doesn\'t work - maybe because a thread is ne

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-10 14:29

    Just as Ash Burlaczenko recommended, you'll have to use a BackgroundWorker for that purpose.

    Since, however, you'd like to tie it in with a ProgressBar, I'd recommend looking at this article on CodeProject: ProgressWorker.

    It's fairly easy to use and it updates the progress bar for you automatically. All you'll have to do is remember to call the ProgressWorker.ReportProgress method from time to time in order to update the associated progress bar.

提交回复
热议问题