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;

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();

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();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.