Y
Yuk Tang
I have created my own custom forms called baseform, inheriting normal
form properties and such. Baseform is, as can be expected, the basis
for the other forms in my project. I want to close all forms
whenever the x is clicked on any of those forms, so I go to the
closing event and cycle through the forms collection, closing each of
them down like so.
either
Forms(n).Close
or
Systems.Windows.Forms(n).Close
or something similar. But to my surprise, I don't get the count
property as an option to get n number of forms, and manually putting
in a number doesn't offer close as a valid method either. My guess
was that, since baseform inherits from form, so baseform would be
part of the forms collection as a result.
I can work around it by putting in a method that checks and closes
each form by name, but I'd have thought looping through the
collection via index numbers would be a simpler solution.
I have the feeling that I'm missing something obvious here. Can
someone help? Thanks.
form properties and such. Baseform is, as can be expected, the basis
for the other forms in my project. I want to close all forms
whenever the x is clicked on any of those forms, so I go to the
closing event and cycle through the forms collection, closing each of
them down like so.
either
Forms(n).Close
or
Systems.Windows.Forms(n).Close
or something similar. But to my surprise, I don't get the count
property as an option to get n number of forms, and manually putting
in a number doesn't offer close as a valid method either. My guess
was that, since baseform inherits from form, so baseform would be
part of the forms collection as a result.
I can work around it by putting in a method that checks and closes
each form by name, but I'd have thought looping through the
collection via index numbers would be a simpler solution.
I have the feeling that I'm missing something obvious here. Can
someone help? Thanks.