Solved

What is the best way to updated a user when filling a dataset.

Posted on 2004-08-15
11
195 Views
Last Modified: 2010-08-05
Hello,

I'm building an application were I need to fill a large dataset before using it to display a crystal report. I has been taking up to 30 sec. to retrieve all the data from the server and I need a way to assure the user that the application has not froze up during this time. I cannot get a progress bar to work in this case and have also tried to display a form with an animated gif, but the gif does not animate during the data retrieval. I would like to be able to show the user a true progress if possible, any suggestions?

-Scott
0
Comment
Question by:scottlundstrom
  • 6
11 Comments
 
LVL 5

Expert Comment

by:knowlton
ID: 11806344
Change the mouse cursor to an hour glass?

//pseudocode...

try
{
//change mouse cursor to hourglass

....
....
some lengthy process....
...
...
}
catch(Exception eee)
{
  Tell use what happened during the lengthy process (why it failed)
  change mouse cursor to normal pointer
}
finally
{
  change mouse cursor to normal pointer
}
0
 
LVL 5

Expert Comment

by:knowlton
ID: 11806347
Maybe display another FORM while the process is running.


FORM A   opens   FORM B  (modal)

....some lengthy process.....

FORM B shows animated gif while it is open......

.....lengthy process ends......

close FORM B  (stop the animation)

FORM A is now receiving events once again.
0
 
LVL 5

Expert Comment

by:knowlton
ID: 11806380
I know you tried progress bar already....maybe this will help it work better:

http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B323116


Also...I've run across several articles that say you should thread lengthy events.
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 5

Expert Comment

by:knowlton
ID: 11806388
Here's a fellow who looks like he's given this topic some thought:

http://www.c-sharpcorner.com/Code/2004/July/SingleThreadOps.asp

I hope this helps,

Tom
0
 

Author Comment

by:scottlundstrom
ID: 11806453
Thanks for the input, but I do not just want to show the hourglass and I cannot update the  progressbar (or know what to set the max value at) from the dataset. I've tried to display an animated gif on another form, but while the dataset is filling the gif will not animate. I have also tried launching the form using a new thread, but get out of memory errors. I have also tried to execute the dataset fill process on a new thread and use the original to display and keep the gif animated, but this is also giving me errors. I would really like to show the actual progress if possible, but would settle just for showing a gif if someone could give me an example of launching a new form on a new thread.

Scott
0
 
LVL 5

Accepted Solution

by:
knowlton earned 250 total points
ID: 11806678
Scott:

I understand.


I'll keep throwing stuff at you until something "sticks".  :)

Here is an example I worked through  (off of code project site)....please look through it and see if it can be molded to your needs:

http://www.robotzgame.com/junk/ProgressWindow1.zip
0
 
LVL 5

Expert Comment

by:knowlton
ID: 11806689
If you look at the source code for form 1.....this looks like just what you need:

private void button1_Click(object sender, System.EventArgs e)
            {
                  ProgressWindow progress = new ProgressWindow();
                  progress.Text = "Work";
                  System.Threading.ThreadPool.QueueUserWorkItem( new System.Threading.WaitCallback( DoSomeWork ), progress );
                  progress.ShowDialog();
            }



System.Threading.ThreadPool.QueueUserWorkItem( new System.Threading.WaitCallback( DoSomeWork ), progress );

You would replace  DoSomeWork   function guts   with  your   own   code.........



0
 
LVL 1

Expert Comment

by:chmohan
ID: 11812914
why dont u retrieve  the data in chunks and  show a  datagrid or so with the data retrieved ,and at the end create the report and display it
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question