Error Creating Control - No parameterless constructor defined for this object

Discussion in 'ASP .Net' started by Nathan Sokalski, Nov 21, 2006.

  1. I have created a custom control for ASP.NET using VB.NET. My control inherits from the System.Web.UI.WebControls.CompositeControl class, and is working fine. However, the Visual Studio .NET designer shows the following error on the control in the designer:

    Error Creating Control - No parameterless constructor defined for this object

    I have defined four New methods. Although none of them are simply Public Sub New(), one of them has just one parameter which is optional. I would think that this would cover the requirement of having a parameterless constructor, since it can be called with no parameters. However, the designer doesn't seem to like it (although my control has run succesfully in all my test runs with no errors). When I try adding a parameterless constructor, I recieve an error in the code editor that mentions the overload that has a single optional parameter, which makes since because if it was called with no parameters there would be an ambiguity between them. What can I do about the error message in the designer? Thanks.



    --
    Nathan Sokalski

    http://www.nathansokalski.com/
     
    Nathan Sokalski, Nov 21, 2006
    #1
    1. Advertising

  2. Visual Studio does not know that the paramter is optional or what to provide in the paramters.
    Explicitly have paramterless constructor.


    --
    Happy Hacking,
    Gaurav Vaish | www.mastergaurav.com
    www.edujinionline.com
    http://eduzine.edujinionline.com
    -----------------------------------------


    "Nathan Sokalski" <> wrote in message news:eWto$...
    I have created a custom control for ASP.NET using VB.NET. My control inherits from the System.Web.UI.WebControls.CompositeControl class, and is working fine. However, the Visual Studio .NET designer shows the following error on the control in the designer:

    Error Creating Control - No parameterless constructor defined for this object

    I have defined four New methods. Although none of them are simply Public Sub New(), one of them has just one parameter which is optional. I would think that this would cover the requirement of having a parameterless constructor, since it can be called with no parameters. However, the designer doesn't seem to like it (although my control has run succesfully in all my test runs with no errors). When I try adding a parameterless constructor, I recieve an error in the code editor that mentions the overload that has a single optional parameter, which makes since because if it was called with no parameters there would be an ambiguity between them. What can I do about the error message in the designer? Thanks.



    --
    Nathan Sokalski

    http://www.nathansokalski.com/
     
    Gaurav Vaish \(www.EdujiniOnline.com\), Nov 21, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. simon place
    Replies:
    4
    Views:
    356
    simon place
    Mar 7, 2004
  2. Oodini
    Replies:
    1
    Views:
    1,846
    Keith Thompson
    Sep 27, 2005
  3. Generic Usenet Account
    Replies:
    10
    Views:
    2,353
  4. Julia B
    Replies:
    8
    Views:
    539
    Mike Baker
    Nov 21, 2008
  5. vncntj

    Newbie: does not have a parameterless constructor

    vncntj, Nov 25, 2007, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    180
    vncntj
    Nov 25, 2007
Loading...

Share This Page