User Control Constructor With Patameter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LukasMalik
    New Member
    • Jan 2008
    • 22

    User Control Constructor With Patameter

    Hi all,

    .NET 3.5, WinForm app, C#, Visual Studio 2008

    I have created custom control comTextBox, I added it drag-drop to form. Done, compiled, run, all OK. Month ago I changed control constructor and I added to constructor parameter and I manualy changed all designer.cs files

    Compiled, works fine, but components are not visible in design mode.

    this is current constructor which works fine fails when Visual Studion loads design form:
    [code=cpp]
    public comTextBox (InSettings _InSettings)
    {
    this.oInSetting s = _InSettings;
    }[/code]

    So, I changed constructor like this (yes I know that in InSettings constructor is large code which will slow application if I create NEW object in every comTextBox control, which is widely used)
    [code=cpp]
    public comTextBox ()
    {
    this.oInSetting s = new InSettings();
    }
    [/code]
    and what a surprise, I get another one error - somethink like object set:
    Object reference not set to an instance of an object

    So, how to correctly, for Visual Studio too, add a parameter to a constructor?
    Last edited by Frinavale; Mar 14 '08, 03:39 PM. Reason: added [code] tags
Working...