Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

Inheritance on the UI

Hi All,

I have an inheritance question. I have a base UI class that implements functionality that derived classes should have from a control. Something like:

'Controls
Friend Class BaseControl{
  //base methods
}

Friend Class BaseForm{
  Protected WithEvents ctrlControl As BaseControl
}

Friend Class DerivedControl Inherits BaseControl{
    //derived methods
}

Friend Class DerivedForm Inherits BaseForm{
    //derived form methods
    ctrlControl = New DerivedControl()
}


After creating the DerivedForm class, I dropped a DerivedControl onto the form, renamed it ctrlControl, and removed the initialization of the control from the derived form.

Now the VS Designer breaks and won't show me the control on the derived form.

Is there any reason why the designer wouldn't be able to see the control? I get a warning in designer mode that 'The variable 'ctrlControl' is either undeclared or was never assigned'

CF
Friday, March 26, 2004

Sorry to reply to my own post, but I am just going to use a mustoverride method in the derived class to return the derived control object and work with it from that standpoint.

CF
Friday, March 26, 2004

*  Recent Topics

*  Fog Creek Home