By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,294 Members | 2,588 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,294 IT Pros & Developers. It's quick & easy.

Form Load and showing form while it is loading

P: 20
Hi,

I am writing a C# mobile 6 (dot.net 3.5) application.

On the form, I have a label. I update this label with text as my initalizing routines are running (from the form load event), such as initializing the database, setting variables, setting up the GPS, etc.

That is why I want the form to display first,so that when my routines (in the form load event) run, I want the label to update with text such as "Initializing the database".

I can update the label, but the form is never shown until everything has run and all that occurs is the wait cursor showing.

I have tried everything, like this.show and an application doevents in the form load event, but it wont physically show the form until all the routines in the form load routine have completed.

I have tried form activate as well, but that exhibited the same behaviour as the form load.

Is there anyway to halt processing until the form is displayed, or is there another command other than this.show.

Is there a different way to actually know the form is displayed before proceding?

Any ideas?

Thanks,
Robert
Jan 14 '10 #1

✓ answered by markmcgookin

Once you have done the text change for the lable you might want to try refreshing the lable to see if that will redraw it.

Expand|Select|Wrap|Line Numbers
  1. this.lable1.text = "SomeText";
  2. this.lable1.Refresh();
  3.  

Share this Question
Share on Google+
4 Replies


markmcgookin
Expert 100+
P: 648
Once you have done the text change for the lable you might want to try refreshing the lable to see if that will redraw it.

Expand|Select|Wrap|Line Numbers
  1. this.lable1.text = "SomeText";
  2. this.lable1.Refresh();
  3.  
Jan 14 '10 #2

P: 20
Thanks for the help.

When I first read your response, i was going to reply that I am not even seeing the form and was wondering why the refresh would work.

However, I went and tried the code, but I mistyped and put

this.refresh();

rather than refreshing the label.

Well, this.refresh(); worked for the form and seems to show it, and, when I am updating the label, it works a treat.

So, thanks for the info, it is working now as I was hoping..

Thanks,
Robert
Jan 15 '10 #3

markmcgookin
Expert 100+
P: 648
Ok, that will redraw the entire form though, it might be a bit faster to just refresh the lable.

this.Refresh(); will do everything on the form

whereas this.Lable1.Refresh(); will just to the lable on its own.

Glad it worked out for you anyway!
Jan 15 '10 #4

P: 20
Thanks for the advice.

I only have three controls.

BUT

I wanted to do this right, and by refreshing the label only does produce the same results are refreshing the whole form...

That is: getting it to display.

Thanks again,
Robert
Jan 17 '10 #5

Post your reply

Sign in to post your reply or Sign up for a free account.