Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

I developed an MDI Environment with several MDIchilds and i would like to prevent the same MDIClient open twice. User clicks once and opens 1 mdi client window, user clicks again and if form exists calls BringToFront() method else if not exists, recreate 1 new mdi client wnd again.

Until here all rocks, but in the second time e recreate (because doesn't exists anymore) a new mdi client window, an error ocurres, because i have a method that uses BeginInvoke((MethodInvoker) delegate{stuff to change})); inside.

The error is about the window handle...

 

How can i prvent this to error, but saving my need of show a single form?

 

Thanks in advance

Posted

I got this answer my self testing more.

So the way i found to solve this issue, was EXPLICITLY unregister the event handler at form closed method.

I worked, and it seems to me that the cause of all this, was because i use a paralel thread with a pooling of 200ms and at the time i wanted to create the new window maybe the handle wasn't yet created when thread wanted access it.

 

Thanks,

Tiago Teixeira

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...