Can't edit a protected menustrip in an inherited form.

  • Thread starter Thread starter Michael.Suarez
  • Start date Start date
M

Michael.Suarez

I have a form in a windows control library with a menustrip on it. The
menustrip, as well as all of the items on it, have their modifiers set
to Protected.

Now i inherit from this form in another project. Neither the menu strip
nor any of its items can be editted... as if they are all private.

However, if i put a button on the form in the control library and make
it protected, I can do whatever i want with the button once i inherit.

What is the difference between the menustrip and the button that
doesn't allow me to have my way with the menustrip? is there a way to
fix this?
 
Hi, Michael

The difference is that menustrip is a collection of controls when button is
a single control.
The problem is because Microsoft limited changing of collections in
inherited forms.
You can read about this problem here:
http://cs.rthand.com/blogs/blog_with_righthand/archive/2005/11/10/186.aspx
For brief description of technical problems which were encountered by
Microsoft development team look at the comment of Shawn Burke (Development
Manager, Windows Forms Team)
 
Thanks for that link. Very interesting.

My idea was to create a base form that already had a set of menu items
that all programs should have, already in its main menu. But it's
probably a better design to just have a base form and a base menustrip
and add the menustrip to the derived form anyway, especially
considering this limitation (or bug or feature, depending how you look
at it).
 
Back
Top