Click here to Skip to main content
14,920,592 members
Home / Discussions / C#
   

C#

 
GeneralRe: Progress Bar Problem Pin
#realJSOP31-Jul-08 2:23
mva#realJSOP31-Jul-08 2:23 
AnswerRe: Progress Bar Problem Pin
Ravi Bhavnani31-Jul-08 2:46
professionalRavi Bhavnani31-Jul-08 2:46 
GeneralRe: Progress Bar Problem Pin
Simon P Stevens31-Jul-08 4:49
MemberSimon P Stevens31-Jul-08 4:49 
GeneralRe: Progress Bar Problem Pin
Syed Shahid Hussain31-Jul-08 17:29
MemberSyed Shahid Hussain31-Jul-08 17:29 
GeneralRe: Progress Bar Problem Pin
Ravi Bhavnani1-Aug-08 1:55
professionalRavi Bhavnani1-Aug-08 1:55 
GeneralRe: Progress Bar Problem Pin
Syed Shahid Hussain1-Aug-08 2:36
MemberSyed Shahid Hussain1-Aug-08 2:36 
QuestionRunning object table changed event Pin
Green Fuze31-Jul-08 0:57
MemberGreen Fuze31-Jul-08 0:57 
QuestionModeless Form with invisible controls [SOLVED] [modified] Pin
#realJSOP31-Jul-08 0:41
mva#realJSOP31-Jul-08 0:41 
Yesterday, I posted a message here about creating a modeless form with a single label control that was not being rendered by the form. Towards the end of the work day yesterday, we had all thought it might just be a problem on my computer (VS2005/SP1 on Vista). However, when I brought the code home and tried it, it happened there too (VS2005/SP1 on XP). It also happened on VS2008 using .Net 2.0 and then using .Net 3.5.

What's really disturbing is that two people here on CP tried the same code, and it did not occur for them.

--------------

This morning, I figured out how to force it to render the control. I added this function to the modeless form:

public void UpdateForm()
{
    this.label1.BringToFront();
    this.Update();
}


and then modified the code that opens/closes the form (remember, this code is in the DoWork() handler of a BackgroundWorker object) looks like this:

private void splashWorker_DoWork(object sender,DoWorkEventArgs e)
{
	BackgroundWorker thisWorker = sender as BackgroundWorker;
	SplashPanel splashPanel = new SplashPanel();
	splashPanel.Show();
	splashPanel.UpdateForm();
	while (!thisWorker.CancellationPending)
	{
	    Thread.Sleep(500);
	}
	splashPanel.Close();
	splashPanel.Dispose();
}


I couldn't find ANYBODY ELSE on the net that had experienced the non-rendered controls problem that I've experienced. In the process of trying to figure t=out the problem, I tried using calls to MessageBox.Show() within various form event handlers, and discovered that the act of displaying a message box caused the label control to be properly displayed. Invalidating the control didn't have any effect. Hiding/showing the control didn't work. It was only out of desperation that I finally discovered that calling BringToFront() would show the control.

I want to know WHY this is necessary, or what is wrong with my Visual Studio (or .Net) install that would cause this problem.

[EDIT] I've come to the conclusion that this is a bug in the .Net framework, starting all the way back at .Net 1.0, and is probably related to the Event loop not being fired correctly. I added a bunch of other types of controls and all of them exhibited the same behavior as my original label control. Everything is fine as long as you are using a modal form (using ShowDialog() to display the form). However, displaying the form as modeless, you get screwed up up results.


"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001


modified on Thursday, July 31, 2008 7:18 AM

QuestionHow to Call C#.Net dll from VB6.0 Pin
rajesh4u31-Jul-08 0:36
Memberrajesh4u31-Jul-08 0:36 
AnswerRe: How to Call C#.Net dll from VB6.0 Pin
Simon P Stevens31-Jul-08 0:45
MemberSimon P Stevens31-Jul-08 0:45 
QuestionSeeking help with error checking codes in the stack builder program shown. Pin
Angelinna31-Jul-08 0:17
MemberAngelinna31-Jul-08 0:17 
AnswerRe: Seeking help with error checking codes in the stack builder program shown. Pin
AhsanS31-Jul-08 0:37
MemberAhsanS31-Jul-08 0:37 
Questionnormalize URL Pin
George_George31-Jul-08 0:13
MemberGeorge_George31-Jul-08 0:13 
AnswerRe: normalize URL Pin
leppie31-Jul-08 0:16
Memberleppie31-Jul-08 0:16 
GeneralRe: normalize URL Pin
George_George31-Jul-08 0:18
MemberGeorge_George31-Jul-08 0:18 
GeneralRe: normalize URL Pin
DaveyM6931-Jul-08 0:26
professionalDaveyM6931-Jul-08 0:26 
GeneralRe: normalize URL Pin
George_George31-Jul-08 0:59
MemberGeorge_George31-Jul-08 0:59 
QuestionDynamic Accessibility Pin
DaveyM6931-Jul-08 0:12
professionalDaveyM6931-Jul-08 0:12 
QuestionShare point problem Pin
manju#12330-Jul-08 23:45
Membermanju#12330-Jul-08 23:45 
GeneralRe: Share point problem Pin
Simon P Stevens31-Jul-08 0:06
MemberSimon P Stevens31-Jul-08 0:06 
GeneralRe: Share point problem Pin
manju#12331-Jul-08 0:31
Membermanju#12331-Jul-08 0:31 
QuestionRecord Audio from Internet Explorer Pin
Malenko30-Jul-08 23:28
MemberMalenko30-Jul-08 23:28 
QuestionA quick question about volatile Pin
Megidolaon30-Jul-08 23:27
MemberMegidolaon30-Jul-08 23:27 
AnswerRe: A quick question about volatile Pin
Guffa30-Jul-08 23:44
MemberGuffa30-Jul-08 23:44 
AnswerRe: A quick question about volatile Pin
Mike Dimmick31-Jul-08 0:13
MemberMike Dimmick31-Jul-08 0:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.