I've got a control called ChatController, as a private member I have:
private frmChat m_chatWindow = null;
In ChatController's constructor I do:
m_chatWindow = new frmChat(strJobNumber, m_emailAddress);
if (m_chatWindow.InvokeRequired)
m_chatWindow.Invoke(new MethodInvoker(delegate { m_chatWindow.Hide(); }));
else
m_chatWindow.Hide();
But I can't hide m_chatWindow
no matter what I do, it randomly thinks InvokeRequired is true or false, and an error is thrown saying "cross-thread blah blah blah..".
This is already existing and the only thing I have changed is m_chatWindow.Show(this)
to m_chatWindow.Hide()
.
Any Ideas how I can resolve this??