473,386 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Marquee Style ProgressBar

JB
Hi All,

I have a Windows Form application that shows a "please wait" form
while I query a database for various information.
I display my form using Show, then run my DB query, then Close the
form at the end.

To make it look even nicer I placed a marquee style Progress Bar on my
form.
It works exactly the same way, but the marquee style progress bar
doesn't move at all while I'm running my DB query, which defeats the
purpose. If I don't close my form straight away after my DB query
returns, the progress bar starts moving.

It looks like the DB query thread is taking over the UI threadand
preventing my progress bar to move. However I was under the (naive)
impression that a marquee style progress bar was "thread independent"
and capable of moving as soon as displayed on a form (almost like an
animated Gif). Can somebody tell me if I can get the progress bar to
move while running the DB query without having to run the DB query in
a different thread.

Thanks
JB
Jun 27 '08 #1
6 10655
JB
On 2 Jun, 17:19, JB <jb.bross...@gmail.comwrote:
Hi All,

I have a Windows Form application that shows a "please wait" form
while I query a database for various information.
I display my form using Show, then run my DB query, then Close the
form at the end.

To make it look even nicer I placed a marquee style Progress Bar on my
form.
It works exactly the same way, but the marquee style progress bar
doesn't move at all while I'm running my DB query, which defeats the
purpose. If I don't close my form straight away after my DB query
returns, the progress bar starts moving.

It looks like the DB query thread is taking over the UI threadand
preventing my progress bar to move. However I was under the (naive)
impression that a marquee style progress bar was "thread independent"
and capable of moving as soon as displayed on a form (almost like an
animated Gif). Can somebody tell me if I can get the progress bar to
move while running the DB query without having to run the DB query in
a different thread.

Thanks
JB
Jun 27 '08 #2
"JB" <jb*********@gmail.comschrieb:
I have a Windows Form application that shows a "please wait" form
while I query a database for various information.
I display my form using Show, then run my DB query, then Close the
form at the end.

To make it look even nicer I placed a marquee style Progress Bar on my
form.
It works exactly the same way, but the marquee style progress bar
doesn't move at all while I'm running my DB query, which defeats the
purpose. If I don't close my form straight away after my DB query
returns, the progress bar starts moving.

It looks like the DB query thread is taking over the UI threadand
preventing my progress bar to move. However I was under the (naive)
impression that a marquee style progress bar was "thread independent"
and capable of moving as soon as displayed on a form (almost like an
animated Gif). Can somebody tell me if I can get the progress bar to
move while running the DB query without having to run the DB query in
a different thread.
I suggest to perform the query in the background thread. It's never a good
idea to block the main UI thread because this will prevent user interaction
(closing forms, etc.).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Jun 27 '08 #3
On Mon, 2 Jun 2008 09:19:05 -0700 (PDT), JB <jb*********@gmail.com>
wrote:
>Hi All,

I have a Windows Form application that shows a "please wait" form
while I query a database for various information.
I display my form using Show, then run my DB query, then Close the
form at the end.

To make it look even nicer I placed a marquee style Progress Bar on my
form.
It works exactly the same way, but the marquee style progress bar
doesn't move at all while I'm running my DB query, which defeats the
purpose. If I don't close my form straight away after my DB query
returns, the progress bar starts moving.

It looks like the DB query thread is taking over the UI threadand
preventing my progress bar to move. However I was under the (naive)
impression that a marquee style progress bar was "thread independent"
and capable of moving as soon as displayed on a form (almost like an
animated Gif). Can somebody tell me if I can get the progress bar to
move while running the DB query without having to run the DB query in
a different thread.

Thanks
JB
Unless you explicitly create another thread to do the DB query, it
runs on the UI thread. Likewise the ProgressBar, being a UI control,
runs totally in the UI thread.

To keep the ProgressBar running you need to run the DB query on
another thread. BackgroundWorker works well for this kind of
operation.
Jun 27 '08 #4
On Jun 2, 7:19 pm, JB <jb.bross...@gmail.comwrote:
Hi All,

I have a Windows Form application that shows a "please wait" form
while I query a database for various information.
I display my form using Show, then run my DB query, then Close the
form at the end.

To make it look even nicer I placed a marquee style Progress Bar on my
form.
It works exactly the same way, but the marquee style progress bar
doesn't move at all while I'm running my DB query, which defeats the
purpose. If I don't close my form straight away after my DB query
returns, the progress bar starts moving.

It looks like the DB query thread is taking over the UI threadand
preventing my progress bar to move. However I was under the (naive)
impression that a marquee style progress bar was "thread independent"
and capable of moving as soon as displayed on a form (almost like an
animated Gif). Can somebody tell me if I can get the progress bar to
move while running the DB query without having to run the DB query in
a different thread.

Thanks
JB
While querying the DB, probably your UI thread is being blocked,
that's why you need to use BackgroundWorker component to show progress
bar marquee animation during the operation asyncronusly.

Thanks,

Onur Güzel
Jun 27 '08 #5
Try Using BackgroundWorker Component.:

Private Sub LoginBtn_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles LoginBtn.Click
ProgressBar.Style = ProgressBarStyle.Marquee
BackWorker.RunWorkerAsync()
End Sub

Private Sub BackWorker_DoWork(ByVal sender As System.Object, ByVal
e As System.ComponentModel.DoWorkEventArgs) Handles BackWorker.DoWork

doConnect()

End Sub

Private Sub BackWorker_RunWorkerCompleted(ByVal sender As Object,
ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles
BackWorker.RunWorkerCompleted
ProgressBar.Style = ProgressBarStyle.Blocks
If Koneksi.StatusKoneksi = "Terkoneksi" Then Connected()
End Sub

Jun 27 '08 #6
JB
Hi All,

Thanks for all your suggestions.
I did implement a BackgroundWorder solution and it wasn't that
complicated after all.

JB

davidkurniawan wrote:
Try Using BackgroundWorker Component.:

Private Sub LoginBtn_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles LoginBtn.Click
ProgressBar.Style = ProgressBarStyle.Marquee
BackWorker.RunWorkerAsync()
End Sub

Private Sub BackWorker_DoWork(ByVal sender As System.Object, ByVal
e As System.ComponentModel.DoWorkEventArgs) Handles BackWorker.DoWork

doConnect()

End Sub

Private Sub BackWorker_RunWorkerCompleted(ByVal sender As Object,
ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles
BackWorker.RunWorkerCompleted
ProgressBar.Style = ProgressBarStyle.Blocks
If Koneksi.StatusKoneksi = "Terkoneksi" Then Connected()
End Sub
Jun 27 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jo_Calico | last post by:
I love the Dynamic Drive cross browser marquee script. I'd like to make the text loop immediately after completion, so the beginning runs right after the end (does that make sense?). Could anyone...
1
by: Sketcher | last post by:
Hi all, I am looking to add the following scrolling marquee to my website (see code below) However instead of using the marquee methods I want to use and as a person rests their mouse on...
2
by: P2P | last post by:
Hi I am wondering if someone can help me here with the "perfect" marquee vertical scrolling script I've found. This marquee is great for me as it will call an external html page. This allow...
4
by: uwe.braunholz | last post by:
Hello, I want to set the text of a marqee dynamical. So I created the following code: ****snip**** <style> #noticeMarquee { background-color:#ff00ff; color:#ffffff;
0
by: =?Utf-8?B?d2luZHNpbQ==?= | last post by:
Hi, I have a c# program that needs to show the progressbar which is circular processbar,just like the one when windows xp loading. I tried below: private void...
8
praclarush
by: praclarush | last post by:
Ok, I'm new to JavaScript and I'm taking a class for it the assignment in it I'm supposed to create edit a pre-made page to display a marquee that automatically scrolls for the user, as well as give...
3
by: joslyn | last post by:
1) Can anyone help me solve this problem by slowing the marquee text? 2) How to stop the marquee text when the mouse over it? Below are the following codes need to be solved: <table...
1
by: ced69 | last post by:
having trouble getting marquee to work get object required errors tring t <title>This Month at the Chamberlain Civic Center</title> <link href="styles.css" rel="stylesheet"...
3
by: Rajneesh Chellapilla | last post by:
Hi I made this marquee program however, I am having trouble getting all four marquees to line up correctly. Basically I want the the 4 marquees to line up on the four sides exactly so they intersect....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.