G
Guest
Hi
In a Windows forms application I have 2 forms A and B; Form B inherits from
form A. Form A is never displayed and its only purpose is to be inherited
from and therefore contains mostly public/protected methods that I have
created (as well a few controls that inheriting forms may use). In my method
on form A (public virtual void setcontrols()) I need a list of all controls
on the instantiated form (in this example form B). Form B has a Menu (with 5
MenuItems), an inherited Panel and Button and an additional Button. Help
seems to indicate that "this.Controls.Count" should return an integer count
of all the controls on the instantiated form B. "this.Controls.Count" returns
the actual int value of 1 rather than 8 (which is what I expect).
On the basis that "this.Controls" is the correct method to use, why don't a
get a count (8) of all the controls and is "this.Controls" the correct method
to use anyway? If this is not the correct method then what is the correct
method?
Thanks in advance.
In a Windows forms application I have 2 forms A and B; Form B inherits from
form A. Form A is never displayed and its only purpose is to be inherited
from and therefore contains mostly public/protected methods that I have
created (as well a few controls that inheriting forms may use). In my method
on form A (public virtual void setcontrols()) I need a list of all controls
on the instantiated form (in this example form B). Form B has a Menu (with 5
MenuItems), an inherited Panel and Button and an additional Button. Help
seems to indicate that "this.Controls.Count" should return an integer count
of all the controls on the instantiated form B. "this.Controls.Count" returns
the actual int value of 1 rather than 8 (which is what I expect).
On the basis that "this.Controls" is the correct method to use, why don't a
get a count (8) of all the controls and is "this.Controls" the correct method
to use anyway? If this is not the correct method then what is the correct
method?
Thanks in advance.