Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problems with methodinvoker

Status
Not open for further replies.

Tanneeru1

Programmer
Joined
Oct 25, 2004
Messages
1
Location
US
Hi I am trying to open a window by using methodinvoker but its giving "cannot call invoker or invokeasync on a control until the window handle has been created"
////////////////////////
this.Invoke(new MethodInvoker(Details));

private void Details()
{
DialogDetails dlg=new DialogDetails ();
DialogResult result = dlg.ShowDialog();
}
/////////////////////
Please can anyone help me in this

Thanks
Tann1
 
From doc:
>>The Inoke() executes the specified delegate on the thread that owns the control's underlying window handle.>>
Where did you put the Invoke() call ?
Assume that DialogDetails is a form and there is a button on the main form.
The following code is working:
Code:
private void Details()
{
DialogDetails dlg=new DialogDetails ();
DialogResult result = dlg.ShowDialog();
}

private void btnShowDetails_Click(object sender, System.EventArgs e)
{
this.Invoke(new MethodInvoker(Details));
}
-obilsavu-

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top