473,320 Members | 1,974 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,320 software developers and data experts.

load data from database asyc while UI loads...

How would I go about doing this? I know it has to do with threading but not
sure how to code this to do something like this...

I have a form which is complex... but I need to load data async while the
form displays with out stoping the form from rendering (right now there is a
2 second pause)

I want to when the form opens load the form and in parallel start to pull
data from the database (about 2,000 records) and while that is going on have
the mouse cursor has a wait cursor then when its down populate the form's
data on screen and change the cursor back... and suggestions or examples on
how to do something like this? thanks!
Dec 5 '07 #1
2 2232
On Tue, 04 Dec 2007 19:40:07 -0800, Smokey Grindel <no****@nospam.com>
wrote:
[...]
I have a form which is complex... but I need to load data async while the
form displays with out stoping the form from rendering (right now there
is a
2 second pause)
The usual solution is to execute the time-consuming operation using the
BackgroundWorker class. It provides progress and completion events that
intrinsically handle the cross-thread issues for you when updating the UI
as the operation progresses.

You can set the cursor displayed when the cursor is over your
application's form by using the Cursor property of the form. See also
Cursors.WaitCursor.

Pete
Dec 5 '07 #2
Also, depending on the provider, you might have asynchronous methods on
the connection itself which allow for asynchronous calls.

If you have a large number of calls that need to be made, then doing it
all on one thread with a BackgroundWorker will be better, since you can
encapsulate all of the calls in one place, but if you have just one query to
execute, then you should consider the asynchronous methods if your provider
provides it.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Peter Duniho" <Np*********@nnowslpianmk.comwrote in message
news:op***************@petes-computer.local...
On Tue, 04 Dec 2007 19:40:07 -0800, Smokey Grindel <no****@nospam.com>
wrote:
>[...]
I have a form which is complex... but I need to load data async while the
form displays with out stoping the form from rendering (right now there
is a
2 second pause)

The usual solution is to execute the time-consuming operation using the
BackgroundWorker class. It provides progress and completion events that
intrinsically handle the cross-thread issues for you when updating the UI
as the operation progresses.

You can set the cursor displayed when the cursor is over your
application's form by using the Cursor property of the form. See also
Cursors.WaitCursor.

Pete

Dec 5 '07 #3

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

Similar topics

6
by: Shabam | last post by:
A web application of mine developed using C# + MS SQL runs fine normally. However when I stress test it with a load testing software (using about 60 simultaneous users) some instances start...
3
by: Prince Kumar | last post by:
When running LOAD with "ALLOW READ ACCESS", I get the following error if select is running againt the table (isolation UR). load.sql --------- db2 load from /u02/data/dly_d040817_test.dat of...
6
by: B B | last post by:
Okay, here is what's happening: I have a reasonably fast laptop (1.4 GHz Mobile M, so comparable to 2.5GHz P4) doing .net development. Running Windows XP pro, SP2 IIS is installed and running...
7
by: UJ | last post by:
I've got a page with a user control on it. While the page is loading, it needs to check certain conditions of the user object to enable/disable things on the screen. Currently in the page_load of...
10
by: aj | last post by:
DB2 WSUE LUW v8.2 FP4 (aka v8.1 FP11) RHEL AS 4 I am EXPORTing in IXF format from one schema and then LOADing into another schema on another server. The DB modeling tool I am using likes to...
7
by: P. Adhia | last post by:
Sorry for quoting an old post and probably I am reading out of context so my concern is unfounded. But I would appreciate if I can get someone or Serge to confirm. Also unlike the question asked in...
1
by: huyuhui | last post by:
The following is a question of LOAD utility. Question: How does the DB2 enforce table check constraints for data added to table with the LOAD utility? A. With the BUILD phase of LOAD B. With the...
3
by: GauravGupta | last post by:
i want to know that is it posible to call button click event before page load event on post back.... please help me....
2
jamwil
by: jamwil | last post by:
What's up guys. I'm having some issues... I've created a method as part of my lifestreaming class which takes an rss feed, and puts the data into a database... It's fairly simple... Check...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.