Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text not showing in label on form

Status
Not open for further replies.

rb8452

Programmer
Oct 11, 2002
3
US
I am writing an application where I want to use a form as a message box that will be displayed while another form is loading. Since it takes several seconds for the form to load I want to tell the user what is going on. I am passing the message text to a method in the form called ShowMessage. The form will then be opened while the form is loading and closed aftger it is open.
The problem is that the text in the label on the form will not show. When the form opens, the space where the label is is transparent. If I open the form as a dialog the text shows as it's supposed to.
Thank you in advance for your help.
 
Put an Application.DoEvents(); and see what happens. Put it right after calling that method.
 
2 Things: If you have antivirus software turned on - that can cause GUI issues.

the other thing is, how are you communicating between threads? I have noticed that the 1.1 framework allows threads to fight for GUI updates (bad cross threading!) where as the 2.0 Framework does not.

Are you calling invoke() on your controls to do the updates, are you using delegates? and do you share variables between threads?
 
The Application.DoEvents() did the trick. I should have known that. [blush]

Thanks for your help
 
I would also investigate the use of a delegate and BeginInvoke. It would be the more correct approach, and will prevent the threading exception you'll get at runtime after porting to VS.NET 2005

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top