Quantcast
Channel: C# Windows Form inheritance
Viewing all articles
Browse latest Browse all 9

C# Windows Form inheritance

$
0
0

Thanks for all your help. It made me think a littlle more about the process of initialising the forms. On investigation I noticed that the InitializeComponent() call was missing from the WindowBase constructor. This means the code in the designer is never called so the properties are never initialised correctly.

Just so everyone is clear on what I actually tried hers the class diagram

Code would be something like

publicclass ApplicationWindowBase : Form
{public ApplicationWindowBase()
    {
          InitializeComponent();
     }
}publicclass ViewBase : ApplicationWindowBase
{public ViewBase()
    {
         InitializeComponent(); // This is what I was missing
    }
}publicclass VoucherProcessingView : ViewBase
{public VoucherProcessingView()
     {
          InitializeComponent();
     }
}


As Initializecomponent() sets up all the properties missing the middle one meant I did not get the settings applied to it.

Thanks again

Ian


Viewing all articles
Browse latest Browse all 9

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>