System.InvalidOperationException

Discussion in 'Programming' started by pooyadavoodi, Feb 29, 2008.

  1. #1
    Hi,
    I developed an application that has a form (1st form) with a button. when I press the button another form (2nd form) is displayed which has a button too. when I press this button another form (3rd form) is displayed and then when I close this form the 2nd form is showed again but immediately 'System.InvalidOperationException' is occurred with the following message:

    Invoke or BeginInvoke cannot be called on a control until the window handle has been created.

    I use the following codes for showing and closing the forms:

    frm2 obj2 = new frm2();
    obj2.ShowDialog();


    this.Close();

    There is a ReportViewer in the 3rd form that works fine.

    Thanks in advance for any help to resolve the exception.
     
    pooyadavoodi, Feb 29, 2008 IP