Re: Exposing a field in a base control to inherited control via de



Thanks for your response. As I stated in my initial query that is exactly
what I am trying to do. I have a panel in a base form that I want to somehow
encapsulate in the child form AND have it be designable in the inheriting
form.

--
Rich


"Kevin Spencer" wrote:

If it is protected, it is not available to any classes other than the class
that declared it and any classes that inherit that class.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Big thicks are made up of lots of little thins.


"Rich Denis" <cojones@xxxxxxxxxxxxxxxx> wrote in message
news:7283062B-A22C-43D4-A29F-862E49E3567F@xxxxxxxxxxxxxxxx
Hello,
I apologize if this issue has been brought up before but I could not find
reference to it. Any help would be appreciated.

Here's the basic situation. We have a base form that controls the general
layout of things for all the various forms in the Order hosted app. The
form
has a panel on it; lets call it contentPanel. We have forms that inherit
from this base form and need to be able to place controls in contentPanel
using the visual designer.

Currently, we have something like:

class BaseForm
{
protected Panel contentPanel;
}

class InheritedForm : BaseForm
{
private Control someControl;

void InitializeComponent()
{
// the designer inserts code similar to
contentPanel.Controls.Add(someControl);
}
}

What you see above works, but exposing the field contentPanel bothers me.
I
don't really like exposing fields, especially collections and containers,
to
outside classes. Unfortunately, I don't know of any way to encapsulate
the
field and still have things work properly in the designer. Does anyone
have
thoughts on how to arrange things such that I can make contentPanel a
private
field and still be able to use the designer in the inherited form?


--
Rich



.



Relevant Pages

  • Re: Exposing a field in a base control to inherited control via design
    ... You can access even private fields via reflection. ... We have a base form that controls the general ... lets call it contentPanel. ... using the visual designer. ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Windows Form inheritance problem
    ... I have a problem when I tried to inherit a form from a base form. ... The designer could not be shown for tghe file because none of the ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Exposing a field in a base control to inherited control via design
    ... that declared it and any classes that inherit that class. ... We have a base form that controls the general ... lets call it contentPanel. ... using the visual designer. ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Windows Form problem in Designer
    ... I have a form that when opened in the designer appears of the screen. ... form selector can't be dragged and if I scroll right and down ... The solution consists of a base form and two forms that inherit ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Inherited Form
    ... desperation we added an invisible label on the child form. ... > I've created a base form that I want other forms to visually inherit from. ... in the designer it looks perfect. ...
    (microsoft.public.dotnet.framework.windowsforms)

Loading