in main form, Hide method does not work, but when I use code snippet below for hiding my form, it work.
What's the difference?
BeginInvoke(new MethodInvoker(delegate
Code
{
Hide();
} ) );Thanks
{
Hide();
} ) );Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Jun 9, 2011, 10:19 AM EDT
In a case such as this, you have to marshal the call to Hide() back to the UI thread which is what your code does. BeginInvoke() does this asynchronously and Invoke() does it synchronously.
FroglegRank #1,020 · 1.9K reputationPosted Jun 9, 2011, 10:14 AM EDT
this.Hide();
Majid KamaliRank #6,453 · 266 reputationPosted Jun 9, 2011, 10:26 AM EDT
Why it should be in a different thread ?
VulpesRank #55 · 29.2K reputationPosted Jun 9, 2011, 10:32 AM EDT