|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
MDI gets FormClosing but non-Child forms also open do not.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 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. Show quoteHide quote " Academic" <academicNOSPAM@a-znet.com> wrote in message news:%23CweaTdAHHA.3316@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 > > 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. ---------------------------------- Show quoteHide quote " Academic" <academicNOSPAM@a-znet.com> wrote in message news:OUnXlmeAHHA.1556@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" <academicNOSPAM@a-znet.com> wrote in message > news:%23CweaTdAHHA.3316@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 >> >> > > 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 Show quoteHide quote "RobinS" <RobinS@NoSpam.yah.none> wrote in message news:E5idnYgrBp92ks3YnZ2dnUVZ_o-dnZ2d@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" <academicNOSPAM@a-znet.com> wrote in message > news:OUnXlmeAHHA.1556@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" <academicNOSPAM@a-znet.com> wrote in message >> news:%23CweaTdAHHA.3316@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 >>> >>> >> >> > > But if the application is closing the system will close all forms so I'd
expect the events to be called. Show quoteHide quote "Garry" <garrygrol***@gmail.com> wrote in message news:%235v5w$iAHHA.3316@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" <RobinS@NoSpam.yah.none> wrote in message > news:E5idnYgrBp92ks3YnZ2dnUVZ_o-dnZ2d@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" <academicNOSPAM@a-znet.com> wrote in message >> news:OUnXlmeAHHA.1556@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" <academicNOSPAM@a-znet.com> wrote in message >>> news:%23CweaTdAHHA.3316@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 >>>> >>>> >>> >>> >> >> > > The application is closing so naturally all forms must close
Thanks Show quoteHide quote "RobinS" <RobinS@NoSpam.yah.none> wrote in message news:E5idnYgrBp92ks3YnZ2dnUVZ_o-dnZ2d@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" <academicNOSPAM@a-znet.com> wrote in message > news:OUnXlmeAHHA.1556@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" <academicNOSPAM@a-znet.com> wrote in message >> news:%23CweaTdAHHA.3316@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 >>> >>> >> >> > > 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 <Exit> on 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. Show quoteHide quote " Academic" <academicNOSPAM@a-znet.com> wrote in message news:eHBRJLnAHHA.4348@TK2MSFTNGP04.phx.gbl... > The application is closing so naturally all forms must close > > Thanks > > > "RobinS" <RobinS@NoSpam.yah.none> wrote in message > news:E5idnYgrBp92ks3YnZ2dnUVZ_o-dnZ2d@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" <academicNOSPAM@a-znet.com> wrote in message >> news:OUnXlmeAHHA.1556@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" <academicNOSPAM@a-znet.com> wrote in message >>> news:%23CweaTdAHHA.3316@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 >>>> >>>> >>> >>> >> >> > > 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 Show quoteHide quote "RobinS" <RobinS@NoSpam.yah.none> wrote in message news:e86dnRGredzBm8zYnZ2dnUVZ_rGdnZ2d@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 <Exit> on 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" <academicNOSPAM@a-znet.com> wrote in message > news:eHBRJLnAHHA.4348@TK2MSFTNGP04.phx.gbl... >> The application is closing so naturally all forms must close >> >> Thanks >> >> >> "RobinS" <RobinS@NoSpam.yah.none> wrote in message >> news:E5idnYgrBp92ks3YnZ2dnUVZ_o-dnZ2d@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" <academicNOSPAM@a-znet.com> wrote in message >>> news:OUnXlmeAHHA.1556@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" <academicNOSPAM@a-znet.com> wrote in message >>>> news:%23CweaTdAHHA.3316@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 >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > 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 Show quoteHide quote " Academic" <academicNOSPAM@a-znet.com> wrote in message news:u091SZsAHHA.3604@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" <RobinS@NoSpam.yah.none> wrote in message > news:e86dnRGredzBm8zYnZ2dnUVZ_rGdnZ2d@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 <Exit> on 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" <academicNOSPAM@a-znet.com> wrote in message >> news:eHBRJLnAHHA.4348@TK2MSFTNGP04.phx.gbl... >>> The application is closing so naturally all forms must close >>> >>> Thanks >>> >>> >>> "RobinS" <RobinS@NoSpam.yah.none> wrote in message >>> news:E5idnYgrBp92ks3YnZ2dnUVZ_o-dnZ2d@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" <academicNOSPAM@a-znet.com> wrote in message >>>> news:OUnXlmeAHHA.1556@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" <academicNOSPAM@a-znet.com> wrote in message >>>>> news:%23CweaTdAHHA.3316@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 >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > thanks for the insight
Show quoteHide quote "RobinS" <RobinS@NoSpam.yah.none> wrote in message news:bbOdnfQqLrptuMzYnZ2dnUVZ_sSdnZ2d@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" <academicNOSPAM@a-znet.com> wrote in message > news:u091SZsAHHA.3604@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" <RobinS@NoSpam.yah.none> wrote in message >> news:e86dnRGredzBm8zYnZ2dnUVZ_rGdnZ2d@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 <Exit> on 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" <academicNOSPAM@a-znet.com> wrote in message >>> news:eHBRJLnAHHA.4348@TK2MSFTNGP04.phx.gbl... >>>> The application is closing so naturally all forms must close >>>> >>>> Thanks >>>> >>>> >>>> "RobinS" <RobinS@NoSpam.yah.none> wrote in message >>>> news:E5idnYgrBp92ks3YnZ2dnUVZ_o-dnZ2d@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" <academicNOSPAM@a-znet.com> wrote in message >>>>> news:OUnXlmeAHHA.1556@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" <academicNOSPAM@a-znet.com> wrote in message >>>>>> news:%23CweaTdAHHA.3316@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 >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > 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 Show quoteHide quote " Academic" <academicNOSPAM@a-znet.com> schreef in bericht news:%23CweaTdAHHA.3316@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 > > 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 Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:Ou8%23pDjAHHA.1196@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" <academicNOSPAM@a-znet.com> schreef in bericht > news:%23CweaTdAHHA.3316@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 >> >> > > 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/library/system.windows.forms.form.mdichildren.aspx The nothing is not so good for this, I hope this helps, Cor Show quoteHide quote " Academic" <academicNOSPAM@a-znet.com> schreef in bericht news:%232umUVnAHHA.4428@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]" <notmyfirstn***@planet.nl> wrote in message > news:Ou8%23pDjAHHA.1196@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" <academicNOSPAM@a-znet.com> schreef in bericht >> news:%23CweaTdAHHA.3316@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 >>> >>> >> >> > > 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 Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:O7Qb1dpAHHA.4024@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/library/system.windows.forms.form.mdichildren.aspx > > The nothing is not so good for this, > > I hope this helps, > > Cor > > > " Academic" <academicNOSPAM@a-znet.com> schreef in bericht > news:%232umUVnAHHA.4428@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]" <notmyfirstn***@planet.nl> wrote in message >> news:Ou8%23pDjAHHA.1196@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" <academicNOSPAM@a-znet.com> schreef in bericht >>> news:%23CweaTdAHHA.3316@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 >>>> >>>> >>> >>> >> >> > >
Query based on user input
C# help!!! LsaOpenPolicy : Attempted to read or write protected memory Challenge? [De-]Serialise a class derived from DataTable. Getting XML Version difference between MyBase.Closing and MyBase.FormClosing Memory by user Sorting a datagrigview Getting an application to be on top of other applications Treeview - relative position |
|||||||||||||||||||||||