I am using a delegate to capture the event of the change of the property and then I am changing the text value of the associated tab. The problem is that after I added the delegate code, I am unable to render the form in the designer. It's telling me that the 'Object reference not set to an instance of an object.'
The error is traced back to the InitializeComponent() where the user control attempts to set the default value on the caption property.
Here is the code snippets.
Error happens here:
Expand|Select|Wrap|Line Numbers
- this.tabPanelPageContainer1.Caption = "";
Expand|Select|Wrap|Line Numbers
- public string Caption
- {
- get
- {
- return _caption;
- }
- set
- {
- _caption = value;
- OnCaptionChange(new PageEventArgs(_caption));
- }
- }
Expand|Select|Wrap|Line Numbers
- /// <summary>
- /// Event arguments class for the page events
- /// </summary>
- public class PageEventArgs : EventArgs
- {
- private string _caption;
- public PageEventArgs(string caption)
- {
- _caption = caption;
- }
- public string CaptionValue
- {
- get
- {
- return _caption;
- }
- }
- }