how can I show the search progress?!
-
hi i am using c# and ms access and i have a search functionality in my app... i am wondering what's the concept behind showing the search progress by a progress bar? thanks for your help in advance
If you have the number of items being searched then just use a progress bar with Maximum set to that value and set Value to the current index you're searching. If you don't know how many items you're searching then you're best of using the ProgressBar (in .NET 2) with Style set to Marquee which is an "infinite" progressbar. If you're using .NET 1.x there are some articles here on CP which are to do with "Busy" bars which are essentially the same thing.
As of how to accomplish this I wouldn't have a clue at the moment and I'm too lazy to google it
-
If you have the number of items being searched then just use a progress bar with Maximum set to that value and set Value to the current index you're searching. If you don't know how many items you're searching then you're best of using the ProgressBar (in .NET 2) with Style set to Marquee which is an "infinite" progressbar. If you're using .NET 1.x there are some articles here on CP which are to do with "Busy" bars which are essentially the same thing.
As of how to accomplish this I wouldn't have a clue at the moment and I'm too lazy to google it
-
Thanks but what index you're talking about? I'm using the LIKE clause to do a simple search...
Please be more specific with your questions in the future or you'll get more answers you won't understand... I assume you're executing an
SqlCommand
(or something similar) that's taking some time and you don't want your UI to hang while this command is running, right? If this is the case, you could create a progressbar (infinite, like Ed.Poore suggested, since you don't know how long the command will run) and then execute theSqlCommand
in aWorkerThread
. That way your UI will remain responsive while theSqlCommand
is being executed. Once the command has finished you'll have to signalize to your initial class that the progress bar can be removed and that the results can be displayed. If you're still unclear on how to do this, please google for the words written incode style
to get more information on them (esp.WorkerThread
).Regards, mav -- Black holes are the places where god divided by 0...
-
Thanks but what index you're talking about? I'm using the LIKE clause to do a simple search...
The index is referring to (for example) if you were searching through a list or an array then you'll have to iterate through the items and you can use the position of the array / list (i.e. the index) you're currently at to display in the progress bar. You were not clear in your original question as to what you were searching so I gave you two possible methods. If you're executing an SQL Query then you'll have to use an infinite progress bar.
As of how to accomplish this I wouldn't have a clue at the moment and I'm too lazy to google it