I've written a Windows Forms application in C#. When I run a separate thread containing a method that toggles the invisibility of a panel on my form, it works the first time but not the second. Why and how can I fix it?
A:
My guess be he UI code invoking from a background thread is. ;)
Nikola Gedelovski
2009-09-01 07:09:25
A:
Your question is a bit vague, but it sounds like you want to control the UI from a different thread, in which case you will need to synchronise the request. It's difficult to tell you how to do that without knowing what programming language you are using.
Sohnee
2009-09-01 07:27:35
Translation for clarity: Thank you for your answers, i use C# and Visual Studio 2005. (No offense modir, i'm just amaking sure that people can understand you, really!)
RCIX
2009-09-01 08:15:39
Edited it for you
Nifle
2009-09-01 21:13:43
+3
A:
Thanks, solved My Problem by follow Code :
Panel tmp = null;
switch (d.Person)
{
case 1: tmp = backPic1;
break;
case 2: tmp = backPic2;
break;
case 3: tmp = backPic3;
break;
}
if (InvokeRequired)
{
tmp.Invoke(new MethodInvoker(delegate() { tmp.Visible = true; }));
}
else
{
tmp.Visible = true;
}
Modir
2009-09-01 08:14:27
@Modir - you seem to have two accounts. Contact [email protected] about getting them merged.
ChrisF
2009-09-01 21:26:17