Boomerang
Boomerang

Reputation: 812

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

I'm getting this error: Invoke or BeginInvoke cannot be called on a control until the window handle has been created.

On these lines:

        m_SplashForm.Invoke(
                new SplashStatusChangedHandle(delegate(string str) { m_SplashInterface.SetStatusInfo(str); }),
                new object[] { value }
            );

I'm trying to use Application.Exit()

Can anyone help me?

Thanks in advance

Upvotes: 0

Views: 792

Answers (2)

JaredPar
JaredPar

Reputation: 755397

The error message pretty much says it all here. Invoke and BeginInvoke cannot be used on a control until the underlying handle is created. This typically happens when the Form is initially displayed. Are you not displaying the form?

You can also force the issue by calling the CreateControl method.

Upvotes: 1

Cédric Guillemette
Cédric Guillemette

Reputation: 2408

Hook to the Control.OnHandleCreated event then you will be permited to do Application.Exit().

Upvotes: 0

Related Questions