Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Object reference not set to an instance of an object
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01407724
Message ID:
01407725
Views:
32
Never mind. Found it.

I overwrote the CTOR as such:
public XColumnHeader()
{
}
public Header(ColumnHeaders Parent)
{
    InitializeComponent();
    lblCaption.Left = CAPTION_LABEL_MARGIN;
    lblCaption.Top = CAPTION_LABEL_MARGIN;
}
My call does not pass anything so InitializeComponent() never gets called. Changed it to:
public Header()
{
   Header(null);
}
public XColumnHeader(XColumnHeaders Parent)
{
    InitializeComponent();
    lblCaption.Left = CAPTION_LABEL_MARGIN;
    lblCaption.Top = CAPTION_LABEL_MARGIN;
}
I gotta lay off the fruit juice when I'm coding!!!





>I have a label on a usercontrol. I created a Caption property:
>
>
>public string Caption
>{
>    get { return _Caption; }
>    set 
>    { 
>        _Caption = value;
>        lblCaption.Text = _Caption;
>    }
>}
>
>
>On the line where the text of the label is being set I'm getting 'Object reference not set to an instance of an object'.
>If I put my mouse over the 'lblCaption' part I see 'lblCaption null'. Anyone know what's up?
>
>The calling code is:
>
>
>Header HeaderName = new Header();
>HeaderName.Caption = "Name"; ;
>HeaderName.Width = 100;
>HeaderName.Key = "name";
>
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Previous
Reply
Map
View

Click here to load this message in the networking platform