Solved

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

Posted on 2004-08-15
11
192 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel file not created as expected 7 51
C# Single Form 8 29
Wav problem 4 19
Adding  DYMO Labelprinter to c# client application 4 11
Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

863 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

21 Experts available now in Live!

Get 1:1 Help Now