473,410 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

MDI gets FormClosing but non-Child forms also open do not.

I have a MDI form, sometimes child forms and sometimes forms that are
neither
If I close the app the child forms closing and closed event happens followed
by the Mdi form receiving the events..

But the regular forms that are also open do not receive that event. This is
true whether there are child forms open or not.

The MDI form is always open and always gets the events.

FormClosing works the same.
It appears to be true that if there is a MDI form other non-child forms do
not receive the events.

Is that correct???


Thanks
Nov 6 '06 #1
13 2907
I generated a simple solution that has only a MDI form and a non-MDI
non-MdiChild form.

I open the regular form in the Load event of the Mdi form. The Mdi form is
the startup.

Both FormClosing events contain a console writeline statement.

When I click the X to exit the app I see only the output from the Mdi
FormClosing event.

None from the regular form.

It's really so simple that it might be easier to generate the solution then
to download it.
But is the someplace I can upload it so some of you experts might comment -
I'd hate to attach it.

I suppose this behavior could be by design but that seems unlikely.

Not getting the close and closing events when they are relied on is very
significant.


" Academic" <ac************@a-znet.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>I have a MDI form, sometimes child forms and sometimes forms that are
neither
If I close the app the child forms closing and closed event happens
followed by the Mdi form receiving the events..

But the regular forms that are also open do not receive that event. This
is true whether there are child forms open or not.

The MDI form is always open and always gets the events.

FormClosing works the same.
It appears to be true that if there is a MDI form other non-child forms do
not receive the events.

Is that correct???


Thanks


Nov 6 '06 #2

Why would the non-MDI-child form be closed when you
close the MDI form? It's not a child of the MDI form,
and as far as it knows, it is not related in any way
to the MDI form. Closing the MDI form closes the
children (but not until after the MDI form is closed)
because they are related.

If you want to close the non-MDI-child form,
you will have to put something in the FormClosed
or FormClosing event of the MDI form that closes
it specifically.

And if you want the MDI form to close when the "normal"
form is closed, vice versa applies.

Robin S.
----------------------------------

" Academic" <ac************@a-znet.comwrote in message
news:OU**************@TK2MSFTNGP03.phx.gbl...
>I generated a simple solution that has only a MDI form and a non-MDI
non-MdiChild form.

I open the regular form in the Load event of the Mdi form. The Mdi form is
the startup.

Both FormClosing events contain a console writeline statement.

When I click the X to exit the app I see only the output from the Mdi
FormClosing event.

None from the regular form.

It's really so simple that it might be easier to generate the solution
then to download it.
But is the someplace I can upload it so some of you experts might
comment - I'd hate to attach it.

I suppose this behavior could be by design but that seems unlikely.

Not getting the close and closing events when they are relied on is very
significant.


" Academic" <ac************@a-znet.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>>I have a MDI form, sometimes child forms and sometimes forms that are
neither
If I close the app the child forms closing and closed event happens
followed by the Mdi form receiving the events..

But the regular forms that are also open do not receive that event. This
is true whether there are child forms open or not.

The MDI form is always open and always gets the events.

FormClosing works the same.
It appears to be true that if there is a MDI form other non-child forms
do not receive the events.

Is that correct???


Thanks



Nov 7 '06 #3
Academic Hi,

I assume that there is a Forms collection for the application.

If you close the MDI, then, if your intention is truly to end the whole
application, loop, For Each, thru the Forms collection and close each one
individually except the MDI parent.

That should solve your problem although I haven't tried it in VB.NET.

On a philosophical level, you might reconsider why you have to have non-MDI
child forms floating around. That is - unless they are modal forms.

Garry
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:E5******************************@comcast.com. ..
>
Why would the non-MDI-child form be closed when you
close the MDI form? It's not a child of the MDI form,
and as far as it knows, it is not related in any way
to the MDI form. Closing the MDI form closes the
children (but not until after the MDI form is closed)
because they are related.

If you want to close the non-MDI-child form,
you will have to put something in the FormClosed
or FormClosing event of the MDI form that closes
it specifically.

And if you want the MDI form to close when the "normal"
form is closed, vice versa applies.

Robin S.
----------------------------------

" Academic" <ac************@a-znet.comwrote in message
news:OU**************@TK2MSFTNGP03.phx.gbl...
>>I generated a simple solution that has only a MDI form and a non-MDI
non-MdiChild form.

I open the regular form in the Load event of the Mdi form. The Mdi form
is the startup.

Both FormClosing events contain a console writeline statement.

When I click the X to exit the app I see only the output from the Mdi
FormClosing event.

None from the regular form.

It's really so simple that it might be easier to generate the solution
then to download it.
But is the someplace I can upload it so some of you experts might
comment - I'd hate to attach it.

I suppose this behavior could be by design but that seems unlikely.

Not getting the close and closing events when they are relied on is very
significant.


" Academic" <ac************@a-znet.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>>>I have a MDI form, sometimes child forms and sometimes forms that are
neither
If I close the app the child forms closing and closed event happens
followed by the Mdi form receiving the events..

But the regular forms that are also open do not receive that event. This
is true whether there are child forms open or not.

The MDI form is always open and always gets the events.

FormClosing works the same.
It appears to be true that if there is a MDI form other non-child forms
do not receive the events.

Is that correct???


Thanks




Nov 7 '06 #4
Academic,

There are about 12 methods to start a form, it depends from those methods
how you have to close a form.

Probably as you show how you start them, it will be easier to reply on your
question.

Cor

" Academic" <ac************@a-znet.comschreef in bericht
news:%2****************@TK2MSFTNGP02.phx.gbl...
>I have a MDI form, sometimes child forms and sometimes forms that are
neither
If I close the app the child forms closing and closed event happens
followed by the Mdi form receiving the events..

But the regular forms that are also open do not receive that event. This
is true whether there are child forms open or not.

The MDI form is always open and always gets the events.

FormClosing works the same.
It appears to be true that if there is a MDI form other non-child forms do
not receive the events.

Is that correct???


Thanks


Nov 7 '06 #5
The application is closing so naturally all forms must close

Thanks
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:E5******************************@comcast.com. ..
>
Why would the non-MDI-child form be closed when you
close the MDI form? It's not a child of the MDI form,
and as far as it knows, it is not related in any way
to the MDI form. Closing the MDI form closes the
children (but not until after the MDI form is closed)
because they are related.

If you want to close the non-MDI-child form,
you will have to put something in the FormClosed
or FormClosing event of the MDI form that closes
it specifically.

And if you want the MDI form to close when the "normal"
form is closed, vice versa applies.

Robin S.
----------------------------------

" Academic" <ac************@a-znet.comwrote in message
news:OU**************@TK2MSFTNGP03.phx.gbl...
>>I generated a simple solution that has only a MDI form and a non-MDI
non-MdiChild form.

I open the regular form in the Load event of the Mdi form. The Mdi form
is the startup.

Both FormClosing events contain a console writeline statement.

When I click the X to exit the app I see only the output from the Mdi
FormClosing event.

None from the regular form.

It's really so simple that it might be easier to generate the solution
then to download it.
But is the someplace I can upload it so some of you experts might
comment - I'd hate to attach it.

I suppose this behavior could be by design but that seems unlikely.

Not getting the close and closing events when they are relied on is very
significant.


" Academic" <ac************@a-znet.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>>>I have a MDI form, sometimes child forms and sometimes forms that are
neither
If I close the app the child forms closing and closed event happens
followed by the Mdi form receiving the events..

But the regular forms that are also open do not receive that event. This
is true whether there are child forms open or not.

The MDI form is always open and always gets the events.

FormClosing works the same.
It appears to be true that if there is a MDI form other non-child forms
do not receive the events.

Is that correct???


Thanks




Nov 7 '06 #6
But if the application is closing the system will close all forms so I'd
expect the events to be called.

"Garry" <ga**********@gmail.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
Academic Hi,

I assume that there is a Forms collection for the application.

If you close the MDI, then, if your intention is truly to end the whole
application, loop, For Each, thru the Forms collection and close each one
individually except the MDI parent.

That should solve your problem although I haven't tried it in VB.NET.

On a philosophical level, you might reconsider why you have to have
non-MDI child forms floating around. That is - unless they are modal
forms.

Garry
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:E5******************************@comcast.com. ..
>>
Why would the non-MDI-child form be closed when you
close the MDI form? It's not a child of the MDI form,
and as far as it knows, it is not related in any way
to the MDI form. Closing the MDI form closes the
children (but not until after the MDI form is closed)
because they are related.

If you want to close the non-MDI-child form,
you will have to put something in the FormClosed
or FormClosing event of the MDI form that closes
it specifically.

And if you want the MDI form to close when the "normal"
form is closed, vice versa applies.

Robin S.
----------------------------------

" Academic" <ac************@a-znet.comwrote in message
news:OU**************@TK2MSFTNGP03.phx.gbl...
>>>I generated a simple solution that has only a MDI form and a non-MDI
non-MdiChild form.

I open the regular form in the Load event of the Mdi form. The Mdi form
is the startup.

Both FormClosing events contain a console writeline statement.

When I click the X to exit the app I see only the output from the Mdi
FormClosing event.

None from the regular form.

It's really so simple that it might be easier to generate the solution
then to download it.
But is the someplace I can upload it so some of you experts might
comment - I'd hate to attach it.

I suppose this behavior could be by design but that seems unlikely.

Not getting the close and closing events when they are relied on is very
significant.


" Academic" <ac************@a-znet.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl.. .
I have a MDI form, sometimes child forms and sometimes forms that are
neither
If I close the app the child forms closing and closed event happens
followed by the Mdi form receiving the events..

But the regular forms that are also open do not receive that event.
This is true whether there are child forms open or not.

The MDI form is always open and always gets the events.

FormClosing works the same.
It appears to be true that if there is a MDI form other non-child forms
do not receive the events.

Is that correct???


Thanks




Nov 7 '06 #7
Really 12 ways. Maybe you're onto something.
In the real program, in the MdiContainer I do
If gFormCapture Is Nothing Then gFormCapture = New FormCaptureTool

gFormCapture.Show()

gFormCapture.BringToFront()

In the simple test program, in the MdiContainer I do

Imports System.Windows.Forms

Public Class MDIParent1

Private Sub MDIParent1_FormClosing(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing

Console.WriteLine("Closing MDI")

End Sub

Private Sub MDIParent1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

Dim z As New Form1

z.Show()

End Sub

End Class

In the non-Mdi non-Child I do

Public Class Form1

Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing

Console.WriteLine("Closing Form1")

End Sub

End Class
THANKS
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:Ou****************@TK2MSFTNGP03.phx.gbl...
Academic,

There are about 12 methods to start a form, it depends from those methods
how you have to close a form.

Probably as you show how you start them, it will be easier to reply on
your question.

Cor

" Academic" <ac************@a-znet.comschreef in bericht
news:%2****************@TK2MSFTNGP02.phx.gbl...
>>I have a MDI form, sometimes child forms and sometimes forms that are
neither
If I close the app the child forms closing and closed event happens
followed by the Mdi form receiving the events..

But the regular forms that are also open do not receive that event. This
is true whether there are child forms open or not.

The MDI form is always open and always gets the events.

FormClosing works the same.
It appears to be true that if there is a MDI form other non-child forms
do not receive the events.

Is that correct???


Thanks



Nov 7 '06 #8
Academic,

Have a look at the form mdichildren.collection, you probably can come there
with contains (the last I am not sure of) otherwise just looping.

http://msdn2.microsoft.com/en-us/lib...ichildren.aspx

The nothing is not so good for this,

I hope this helps,

Cor
" Academic" <ac************@a-znet.comschreef in bericht
news:%2****************@TK2MSFTNGP04.phx.gbl...
Really 12 ways. Maybe you're onto something.
In the real program, in the MdiContainer I do
If gFormCapture Is Nothing Then gFormCapture = New FormCaptureTool

gFormCapture.Show()

gFormCapture.BringToFront()

In the simple test program, in the MdiContainer I do

Imports System.Windows.Forms

Public Class MDIParent1

Private Sub MDIParent1_FormClosing(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing

Console.WriteLine("Closing MDI")

End Sub

Private Sub MDIParent1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

Dim z As New Form1

z.Show()

End Sub

End Class

In the non-Mdi non-Child I do

Public Class Form1

Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing

Console.WriteLine("Closing Form1")

End Sub

End Class
THANKS
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:Ou****************@TK2MSFTNGP03.phx.gbl...
>Academic,

There are about 12 methods to start a form, it depends from those methods
how you have to close a form.

Probably as you show how you start them, it will be easier to reply on
your question.

Cor

" Academic" <ac************@a-znet.comschreef in bericht
news:%2****************@TK2MSFTNGP02.phx.gbl...
>>>I have a MDI form, sometimes child forms and sometimes forms that are
neither
If I close the app the child forms closing and closed event happens
followed by the Mdi form receiving the events..

But the regular forms that are also open do not receive that event. This
is true whether there are child forms open or not.

The MDI form is always open and always gets the events.

FormClosing works the same.
It appears to be true that if there is a MDI form other non-child forms
do not receive the events.

Is that correct???


Thanks




Nov 7 '06 #9
Maybe I didn't explain good enough.

It is for form that is not a MdiChild that the events are missing.
The MdiChildren and the MdiContainer all receive the events.
The standard folder does not.

If you have two standard forms they receive the events.
If you change one to a MdiContainer the standard form (that is, the one that
is not the MdiContianer) no longer receives the events.
If you like to know about the non-run-of-the-mill situations try the example
below. I think you'll be surprised.
Simply make a solution with two forms and make one a MdiContainer (do NOT
make the other a MdiChild)
Make the MdiContainer the startup form.
Run.
Then exit the app by clicking the stop on the MdiContainer.
And watch the standard form closing event.

Thanks


"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:O7**************@TK2MSFTNGP04.phx.gbl...
Academic,

Have a look at the form mdichildren.collection, you probably can come
there with contains (the last I am not sure of) otherwise just looping.

http://msdn2.microsoft.com/en-us/lib...ichildren.aspx

The nothing is not so good for this,

I hope this helps,

Cor
" Academic" <ac************@a-znet.comschreef in bericht
news:%2****************@TK2MSFTNGP04.phx.gbl...
>Really 12 ways. Maybe you're onto something.
In the real program, in the MdiContainer I do
If gFormCapture Is Nothing Then gFormCapture = New FormCaptureTool

gFormCapture.Show()

gFormCapture.BringToFront()

In the simple test program, in the MdiContainer I do

Imports System.Windows.Forms

Public Class MDIParent1

Private Sub MDIParent1_FormClosing(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing

Console.WriteLine("Closing MDI")

End Sub

Private Sub MDIParent1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

Dim z As New Form1

z.Show()

End Sub

End Class

In the non-Mdi non-Child I do

Public Class Form1

Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing

Console.WriteLine("Closing Form1")

End Sub

End Class
THANKS
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:Ou****************@TK2MSFTNGP03.phx.gbl...
>>Academic,

There are about 12 methods to start a form, it depends from those
methods how you have to close a form.

Probably as you show how you start them, it will be easier to reply on
your question.

Cor

" Academic" <ac************@a-znet.comschreef in bericht
news:%2****************@TK2MSFTNGP02.phx.gbl.. .
I have a MDI form, sometimes child forms and sometimes forms that are
neither
If I close the app the child forms closing and closed event happens
followed by the Mdi form receiving the events..

But the regular forms that are also open do not receive that event.
This is true whether there are child forms open or not.

The MDI form is always open and always gets the events.

FormClosing works the same.
It appears to be true that if there is a MDI form other non-child forms
do not receive the events.

Is that correct???


Thanks




Nov 7 '06 #10
You are going to have to close your forms yourself.
I don't understand what forms the user has open
and what is going on in your application. Just
because you close onevform, it does not necessarily
close all the forms, except in the case of
MDI parents/children.

If you want all forms to close when the MDI parent
is closed, you are going to have to code it that way.

I use a main form on my apps. From there, the user
can go to other forms. If he hits <Exiton any
form to exit the application, I put a close for
the main form in my Form_Closed event. Then in
the Form_Closing event of my main form, I loop
through the open forms and close them, and then
let my main form close.

Robin S.
" Academic" <ac************@a-znet.comwrote in message
news:eH**************@TK2MSFTNGP04.phx.gbl...
The application is closing so naturally all forms must close

Thanks
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:E5******************************@comcast.com. ..
>>
Why would the non-MDI-child form be closed when you
close the MDI form? It's not a child of the MDI form,
and as far as it knows, it is not related in any way
to the MDI form. Closing the MDI form closes the
children (but not until after the MDI form is closed)
because they are related.

If you want to close the non-MDI-child form,
you will have to put something in the FormClosed
or FormClosing event of the MDI form that closes
it specifically.

And if you want the MDI form to close when the "normal"
form is closed, vice versa applies.

Robin S.
----------------------------------

" Academic" <ac************@a-znet.comwrote in message
news:OU**************@TK2MSFTNGP03.phx.gbl...
>>>I generated a simple solution that has only a MDI form and a non-MDI
non-MdiChild form.

I open the regular form in the Load event of the Mdi form. The Mdi form
is the startup.

Both FormClosing events contain a console writeline statement.

When I click the X to exit the app I see only the output from the Mdi
FormClosing event.

None from the regular form.

It's really so simple that it might be easier to generate the solution
then to download it.
But is the someplace I can upload it so some of you experts might
comment - I'd hate to attach it.

I suppose this behavior could be by design but that seems unlikely.

Not getting the close and closing events when they are relied on is very
significant.


" Academic" <ac************@a-znet.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl.. .
I have a MDI form, sometimes child forms and sometimes forms that are
neither
If I close the app the child forms closing and closed event happens
followed by the Mdi form receiving the events..

But the regular forms that are also open do not receive that event.
This is true whether there are child forms open or not.

The MDI form is always open and always gets the events.

FormClosing works the same.
It appears to be true that if there is a MDI form other non-child forms
do not receive the events.

Is that correct???


Thanks




Nov 7 '06 #11
O.K. I've got it but I don't know why it's required. When I exit the app all
the forms are - I don't know what to call it if not "closed" - I guess
"exited" might be a better word if the events are not raised.

Since all the forms go away when the app is exited I guess I was assuming
they were closed.
Thanks for the info

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:e8******************************@comcast.com. ..
You are going to have to close your forms yourself.
I don't understand what forms the user has open
and what is going on in your application. Just
because you close onevform, it does not necessarily
close all the forms, except in the case of
MDI parents/children.

If you want all forms to close when the MDI parent
is closed, you are going to have to code it that way.

I use a main form on my apps. From there, the user
can go to other forms. If he hits <Exiton any
form to exit the application, I put a close for
the main form in my Form_Closed event. Then in
the Form_Closing event of my main form, I loop
through the open forms and close them, and then
let my main form close.

Robin S.
" Academic" <ac************@a-znet.comwrote in message
news:eH**************@TK2MSFTNGP04.phx.gbl...
>The application is closing so naturally all forms must close

Thanks
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:E5******************************@comcast.com ...
>>>
Why would the non-MDI-child form be closed when you
close the MDI form? It's not a child of the MDI form,
and as far as it knows, it is not related in any way
to the MDI form. Closing the MDI form closes the
children (but not until after the MDI form is closed)
because they are related.

If you want to close the non-MDI-child form,
you will have to put something in the FormClosed
or FormClosing event of the MDI form that closes
it specifically.

And if you want the MDI form to close when the "normal"
form is closed, vice versa applies.

Robin S.
----------------------------------

" Academic" <ac************@a-znet.comwrote in message
news:OU**************@TK2MSFTNGP03.phx.gbl...
I generated a simple solution that has only a MDI form and a non-MDI
non-MdiChild form.

I open the regular form in the Load event of the Mdi form. The Mdi form
is the startup.

Both FormClosing events contain a console writeline statement.

When I click the X to exit the app I see only the output from the Mdi
FormClosing event.

None from the regular form.

It's really so simple that it might be easier to generate the solution
then to download it.
But is the someplace I can upload it so some of you experts might
comment - I'd hate to attach it.

I suppose this behavior could be by design but that seems unlikely.

Not getting the close and closing events when they are relied on is
very significant.


" Academic" <ac************@a-znet.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl. ..
>I have a MDI form, sometimes child forms and sometimes forms that are
>neither
>
>
If I close the app the child forms closing and closed event happens
followed by the Mdi form receiving the events..
>
But the regular forms that are also open do not receive that event.
This is true whether there are child forms open or not.
>
The MDI form is always open and always gets the events.
>
FormClosing works the same.
>
>
It appears to be true that if there is a MDI form other non-child
forms do not receive the events.
>
Is that correct???
>
>
>
>
Thanks
>
>




Nov 7 '06 #12
It's required because when you exit the app, the
forms are only closed if you close them. If you
check the Task Manager, you might find that
your app is still running. If you're running it
in the IDE, you probably have to click on the
stop button to get it to stop running.

Good luck.
Robin

" Academic" <ac************@a-znet.comwrote in message
news:u0**************@TK2MSFTNGP04.phx.gbl...
O.K. I've got it but I don't know why it's required. When I exit the app
all the forms are - I don't know what to call it if not "closed" - I guess
"exited" might be a better word if the events are not raised.

Since all the forms go away when the app is exited I guess I was assuming
they were closed.
Thanks for the info

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:e8******************************@comcast.com. ..
>You are going to have to close your forms yourself.
I don't understand what forms the user has open
and what is going on in your application. Just
because you close onevform, it does not necessarily
close all the forms, except in the case of
MDI parents/children.

If you want all forms to close when the MDI parent
is closed, you are going to have to code it that way.

I use a main form on my apps. From there, the user
can go to other forms. If he hits <Exiton any
form to exit the application, I put a close for
the main form in my Form_Closed event. Then in
the Form_Closing event of my main form, I loop
through the open forms and close them, and then
let my main form close.

Robin S.
" Academic" <ac************@a-znet.comwrote in message
news:eH**************@TK2MSFTNGP04.phx.gbl...
>>The application is closing so naturally all forms must close

Thanks
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:E5******************************@comcast.co m...

Why would the non-MDI-child form be closed when you
close the MDI form? It's not a child of the MDI form,
and as far as it knows, it is not related in any way
to the MDI form. Closing the MDI form closes the
children (but not until after the MDI form is closed)
because they are related.

If you want to close the non-MDI-child form,
you will have to put something in the FormClosed
or FormClosing event of the MDI form that closes
it specifically.

And if you want the MDI form to close when the "normal"
form is closed, vice versa applies.

Robin S.
----------------------------------

" Academic" <ac************@a-znet.comwrote in message
news:OU**************@TK2MSFTNGP03.phx.gbl...
>I generated a simple solution that has only a MDI form and a non-MDI
>non-MdiChild form.
>
I open the regular form in the Load event of the Mdi form. The Mdi
form is the startup.
>
Both FormClosing events contain a console writeline statement.
>
When I click the X to exit the app I see only the output from the Mdi
FormClosing event.
>
None from the regular form.
>
It's really so simple that it might be easier to generate the solution
then to download it.
But is the someplace I can upload it so some of you experts might
comment - I'd hate to attach it.
>
I suppose this behavior could be by design but that seems unlikely.
>
Not getting the close and closing events when they are relied on is
very significant.
>
>
>
>
" Academic" <ac************@a-znet.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl.. .
>>I have a MDI form, sometimes child forms and sometimes forms that are
>>neither
>>
>>
>If I close the app the child forms closing and closed event happens
>followed by the Mdi form receiving the events..
>>
>But the regular forms that are also open do not receive that event.
>This is true whether there are child forms open or not.
>>
>The MDI form is always open and always gets the events.
>>
>FormClosing works the same.
>>
>>
>It appears to be true that if there is a MDI form other non-child
>forms do not receive the events.
>>
>Is that correct???
>>
>>
>>
>>
>Thanks
>>
>>
>
>




Nov 8 '06 #13
thanks for the insight

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:bb******************************@comcast.com. ..
It's required because when you exit the app, the
forms are only closed if you close them. If you
check the Task Manager, you might find that
your app is still running. If you're running it
in the IDE, you probably have to click on the
stop button to get it to stop running.

Good luck.
Robin

" Academic" <ac************@a-znet.comwrote in message
news:u0**************@TK2MSFTNGP04.phx.gbl...
>O.K. I've got it but I don't know why it's required. When I exit the app
all the forms are - I don't know what to call it if not "closed" - I
guess "exited" might be a better word if the events are not raised.

Since all the forms go away when the app is exited I guess I was assuming
they were closed.
Thanks for the info

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:e8******************************@comcast.com ...
>>You are going to have to close your forms yourself.
I don't understand what forms the user has open
and what is going on in your application. Just
because you close onevform, it does not necessarily
close all the forms, except in the case of
MDI parents/children.

If you want all forms to close when the MDI parent
is closed, you are going to have to code it that way.

I use a main form on my apps. From there, the user
can go to other forms. If he hits <Exiton any
form to exit the application, I put a close for
the main form in my Form_Closed event. Then in
the Form_Closing event of my main form, I loop
through the open forms and close them, and then
let my main form close.

Robin S.
" Academic" <ac************@a-znet.comwrote in message
news:eH**************@TK2MSFTNGP04.phx.gbl...
The application is closing so naturally all forms must close

Thanks
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:E5******************************@comcast.c om...
>
Why would the non-MDI-child form be closed when you
close the MDI form? It's not a child of the MDI form,
and as far as it knows, it is not related in any way
to the MDI form. Closing the MDI form closes the
children (but not until after the MDI form is closed)
because they are related.
>
If you want to close the non-MDI-child form,
you will have to put something in the FormClosed
or FormClosing event of the MDI form that closes
it specifically.
>
And if you want the MDI form to close when the "normal"
form is closed, vice versa applies.
>
Robin S.
----------------------------------
>
" Academic" <ac************@a-znet.comwrote in message
news:OU**************@TK2MSFTNGP03.phx.gbl.. .
>>I generated a simple solution that has only a MDI form and a non-MDI
>>non-MdiChild form.
>>
>I open the regular form in the Load event of the Mdi form. The Mdi
>form is the startup.
>>
>Both FormClosing events contain a console writeline statement.
>>
>When I click the X to exit the app I see only the output from the Mdi
>FormClosing event.
>>
>None from the regular form.
>>
>It's really so simple that it might be easier to generate the
>solution then to download it.
>But is the someplace I can upload it so some of you experts might
>comment - I'd hate to attach it.
>>
>I suppose this behavior could be by design but that seems unlikely.
>>
>Not getting the close and closing events when they are relied on is
>very significant.
>>
>>
>>
>>
>" Academic" <ac************@a-znet.comwrote in message
>news:%2****************@TK2MSFTNGP02.phx.gbl. ..
>>>I have a MDI form, sometimes child forms and sometimes forms that are
>>>neither
>>>
>>>
>>If I close the app the child forms closing and closed event happens
>>followed by the Mdi form receiving the events..
>>>
>>But the regular forms that are also open do not receive that event.
>>This is true whether there are child forms open or not.
>>>
>>The MDI form is always open and always gets the events.
>>>
>>FormClosing works the same.
>>>
>>>
>>It appears to be true that if there is a MDI form other non-child
>>forms do not receive the events.
>>>
>>Is that correct???
>>>
>>>
>>>
>>>
>>Thanks
>>>
>>>
>>
>>
>
>




Nov 8 '06 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
by: tuvok | last post by:
Is it correct that the virtual dtor of base gets called implicitly? Here's some code to demonstrate what I mean: Class B has a virtual destructor, so has class D which is derived from B. Deleting...
302
by: Lee | last post by:
Hi Whenever I use the gets() function, the gnu c compiler gives a warning that it is dangerous to use gets(). Is this due to the possibility of array overflow? Is it correct that the program...
15
by: ais523 | last post by:
I was just wondering whether there was a portable way to use gets() safely, and came up with this: #include <stdio.h> #include <stdlib.h> int main() { FILE* temp; char buf;
0
by: Frank | last post by:
Hello, in the formClosing event I put an endEdit for the datagridview. Works fine. Except when the cursor is on the line for a new record. That gives errors because some fields are not filled (and...
89
by: Cuthbert | last post by:
After compiling the source code with gcc v.4.1.1, I got a warning message: "/tmp/ccixzSIL.o: In function 'main';ex.c: (.text+0x9a): warning: the 'gets' function is dangerous and should not be...
1
by: pamelafluente | last post by:
Hi, I am not clear if there is there any difference in usage between Closing (mybase) and FormClosing ? Any advice on that ? -P
4
by: Academic | last post by:
I read the Help and some of the many Google hits I got but can't find out the difference between MyBase.Closing and MyBase.FormClosing Can anyone tell me? Thanks
1
by: dani kotlar | last post by:
Is it possible to suspend the closing of a form from the FormClosing event handler, or any other way? Thanks
280
by: jacob navia | last post by:
In the discussion group comp.std.c Mr Gwyn wrote: < quote > .... gets has been declared an obsolescent feature and deprecated, as a direct result of my submitting a DR about it (which...
0
by: Academia | last post by:
I have a Mdi app. In FormClosing, e.CloseReason works OK in the Children. But in the Mdi form it always show UserClosing. Since the children close first I could set a global flag in them...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.