Error Creating Control - No parameterless constructor defined for this object

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default Error Creating Control - No parameterless constructor defined for this object

    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
    [email]njsokalski@hotmail.com[/email]
    [url]http://www.nathansokalski.com/[/url]
    Nathan Sokalski Guest

  2. Similar Questions and Discussions

    1. constructor in dynamicly loaded library containing user defined functions not run when loading from mysql?
      Hi, I've been writing a user defined function with a very expensive initialisation which only needs to run once. I thought it might be possible...
    2. #26121 [Opn->WFx]: Object defined before object - error
      ID: 26121 Updated by: sniper@php.net Reported By: closer at netnitco dot net -Status: Open +Status: ...
    3. #26121 [NEW]: Object defined before object - error
      From: closer at netnitco dot net Operating system: Redhat Linux 9.0 / Apache 2.0.46 PHP version: 5.0.0b2 (beta2) PHP Bug Type: ...
    4. Fatal error: Call to a member function on a non-object in constructor?
      Hi, I'm having a problem that I have a hard time understanding. I am getting a "Fatal error: Call to a member function on a non-object" on a...
    5. Error in CreatObject(""): 32797: Application-defined or object-define error
      Hi, I am getting "Application-defined or object-define error" when trying to instantiate an MTS component. However, when I run the VB source-code...
  3. #2

    Default Re: Error Creating Control - No parameterless constructor defined for this object

    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 | [url]www.mastergaurav.com[/url]
    [url]www.edujinionline.com[/url]
    [url]http://eduzine.edujinionline.com[/url]
    -----------------------------------------


    "Nathan Sokalski" <njsokalski@hotmail.com> wrote in message news:eWto$pRDHHA.2328@TK2MSFTNGP02.phx.gbl...
    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
    [email]njsokalski@hotmail.com[/email]
    [url]http://www.nathansokalski.com/[/url]
    Gaurav Vaish \(www.EdujiniOnline.com\) Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139