How to close a mon-modal window

S

Sumit

Hi all,

I have a windows application in which I open a non-modal window on
click of button.
I want to close that window in case of an event raised on my
application.
This non-modal window is in different assembly than the assembly in
which the MDI form is.

So if there is a way to get a collection of instances of all the open
windows of the application then only the problem can be solved

Kindly help
Warm Regards
Sumit Vohra
 
J

Jon Skeet [C# MVP]

Sumit said:
I have a windows application in which I open a non-modal window on
click of button.
I want to close that window in case of an event raised on my
application.
This non-modal window is in different assembly than the assembly in
which the MDI form is.

So if there is a way to get a collection of instances of all the open
windows of the application then only the problem can be solved

Why not just keep a reference to the window you open (or a list of
references if there could be several)? Subscribe to the window's Closed
event so you don't try to close it if it's already been closed, and
then when you need to close it, you'll know what to close.

Being in a different assembly shouldn't make any difference.

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top