public void EnableUserTextBox(Boolean Enable) { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (this.textBoxUser.InvokeRequired) { EnableUserTextboxCallback d = new EnableUserTextboxCallback(EnableUserTextBox); this.Invoke(d, new object[] { Enable }); } else { // enable or disable the login button textBoxUser.Enabled = Enable; } }