Error Creating Control - No parameterless constructor defined for this object

N

Nathan Sokalski

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.
 
G

Gaurav Vaish \(www.EdujiniOnline.com\)

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
-----------------------------------------


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
(e-mail address removed)
http://www.nathansokalski.com/
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top