Hi I am writing a custom tab control. I am capturing a caption property in a page which then changes the caption of the associated tab. (Similar to window's tab control).
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 InitializeCompo nent() where the user control attempts to set the default value on the caption property.
Here is the code snippets.
Error happens here:
Property code:
Delegate Class
Any idea why it's doing this?
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 InitializeCompo nent() where the user control attempts to set the default value on the caption property.
Here is the code snippets.
Error happens here:
Code:
this.tabPanelPageContainer1.Caption = "";
Code:
public string Caption { get { return _caption; } set { _caption = value; OnCaptionChange(new PageEventArgs(_caption)); } }
Code:
/// <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; } } }
Comment