Solved

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

Posted on 2004-08-15
11
191 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 5

Expert Comment

by:knowlton
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:scottlundstrom
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Article by: Ivo
Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
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…
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now