"Preload" Forms for speed?

S

Scott Johnson

Hi!
Is there a way to "preload" a form using a thread or something else so that
my user doesn't have to wait 5 seconds (initializing time) between forms?
Some of these forms have tab strips with lots of controls and database
queries on them and I would like to try to have some(all) of the preloading
of the next form and controls done in the background while a user is still
entering data.

(For example, my user visits screen A then B then C. While the user is
still viewing/entering data on screen A, I would like form B to preload in
the background. The user clicks "next" or whatever on form A and form B is
then displayed. form C would then begin preloading...and so on.)

Does anyone have any suggestions or advice on what I could do to increase
speed between forms? Is my form flow plan OK? BTW - I'm using VB.NET on
Compact Framework, but I'll gladly accept *any* advice and direction.

Thanks!
--Scott
 
C

CJ Taylor

Scott,

Yeah you can pre-load forms (after all they are classes). However, I don't
know how much of a speed increase you'll get (never tested it).

second off all, I am not sure on the Compact Framework as I have never used
that before. What you may want to do is looking up the
System.Threading.Thread class on your help cd and see if its supported byt
he compact framework, or find something that is.

Hope it helps,
CJ
 
W

William Ryan

At the loading of the main for, declare and initialize an instance of each
form you want either within the main form or create a class with a shared
property for each form. - this will slow loading up but you'll have them all
in memory. Then you can make the forms visible as necessary depending on
what the user wants to do. If you bind them to the main form, you'll have
limited access to everything from the subsequent forms, so you'll probably
want to use a module or create the forms as shard properties of a class.

This link may also be of help...in the CF, you need to squeeze out every lit
bit of efficiency you can
http://msdn.microsoft.com/library/d...s/dnnetcomp/html/netcfimproveformloadperf.asp

HTH,

Bill
 
G

Gary Owsiany

My experiences with "speeding up" forms has taught me to
think like a magician. After all, if the
user "perceives" that a form is loading quickly, or
is "responsive" than it doesn't really matter if it
really is taking 5 seconds to initialize. One trick I
use is "amortizing" the long operations. That is, if it
takes 20 seconds to get a result from a database query,
but, you don't need to display everything from the query,
then break up the query into smaller chunks and display
each chunk as it becomes available. So if it takes 3
seconds to get your first result, then 7 seconds for the
second result and then 10 seconds for your final result,
if you start by displaying the first result in 3 seconds
your gui will seem faster (even though 3 + 7 + 10 = the
original 20 seconds--the user only had to wait 3 seconds
for the gui to display a result). It's all "smoke and
mirrors". When it comes to initializing multiple windows
(or tabs) you can "spread out the pain" by starting the
initialization of the longer running operations first.
Using multiple threads can help with the "amortization"
of the initialization of your multiple windows (or tabs)
but you must take the extra precaution of "synchronizing"
the various threads so that your "main window" thread
doesn't display a partially initialized view. You must
also handle the case where your main thread gets
terminated before the "secondary" threads get an
opportunity to complete. After all, you don't want to
write to a window that has been closed!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top