0

I have a code like below that when pressing a button, panel1 and labelText1 should be seen.
Then I will put the process to "Sleep".
After this, labelText1 should be emty ("") and labelText2 should write "TextMessage2":
Then I wil put the process to "Sleep" again.

And last put panel1 to Visible = false;

The problem is this when pressing the button:
The panel will be shown for about Total: 2 seconds, but I will not see the Text From either labelText1 or labelText2.
I wonder why this is happening. Why does not the labeltext show ?

panel1->Visible = true;
labelText1->Visible = true;
		 
Thread::Sleep(1000);

labelText1->Text = "";
labelText2->Text = "TextMessage2";

Thread::Sleep(1000);
panel1->Visible = false;
2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by Jennifer84
0

You probably need to refresh the form. Invalidate the label after changing the text so that it redraws:

labelText1->Text = "";
labelText2->Text = "TextMessage2";
labelText1->Invalidate();
labelText2->Invalidate();
0

Yes, thank you, that worked. I just figured out that Application:: DoEvents() worked also.

Thank you...

You probably need to refresh the form. Invalidate the label after changing the text so that it redraws:

labelText1->Text = "";
labelText2->Text = "TextMessage2";
labelText1->Invalidate();
labelText2->Invalidate();
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.