How can I display a 'Waiting' form while open a new form?

pisceswzh

Well-known member
Joined
Mar 19, 2007
Messages
96
Programming Experience
1-3
In my application, when open certain forms, it takes a little bit long time, say 5-6 seconds to intialize controllers and to load large amount of data from the SQL server, during this period of time, the system just stucked and the UI doesn't respond to anything.

I am justing wonding whether anyone can provide me with methods to display a "Please wait!" form when the data is loading and controller is initializing? and when the loading process is done, the "Please wait!" form just disappear.

I think it might need to create a second thread, but since when the data is finished loading, my application should display them on the UI thread, so it will probably cause corss-thread issue. So I am just puzzled.

Anyone please help! I appreciate any resources that provided. Thanks!

Tom
 
you have fill() events in the form load?

a smooth method i use is to put the fill methods in the forms shown event and have a label on the form saying 'Loading' once the fills are done hide the label? in this way the form should load instantly (may have to force it to draw) then it loads data? you could also put a progress bar on there, set the style of the bar to Marquee to show its working?
 
Instead of using a form why not use a textbox.
VB.NET:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ' Show "Please wait" textbox
        TextBox1.Visible = True
        My.Application.DoEvents()
        ' Call the long process
        DoWhatEver()
        ' When process is done then hide textbox
        TextBox1.Visible = False
    End Sub
 
Thank you for all of your replays. But I think all these methods are still using single thread technology, means when the application runs, the UI will still not respond, even it may display a label "Waiting..."

By meaning UI doesn't respond, I mean even the data is loading, you may still be able to interact with the form. For example, you may still drag to move the form. I know this is doable by using multi-thread technology. But since most controllers doesn't support multi-thread technology, means they are not thread-safe. I am just puzzled with how to load controllers using multi-thread technology which can drastrically improve my user interface experience.

Now my application runs not very "smoothly" and this "not smoothly" experience doesn't really exist in most commercial products. I just hope anyone can help me in this case. This definitely will make my application look more professional.

Thank you very much.
 
Back
Top