Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Error Creating Control - No parameterless constructor defined for this object

Reply
Thread Tools

Error Creating Control - No parameterless constructor defined for this object

 
 
Nathan Sokalski
Guest
Posts: n/a
 
      11-21-2006
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.velocityreviews.com/forums/(E-Mail Removed)
http://www.nathansokalski.com/
 
Reply With Quote
 
 
 
 
Gaurav Vaish \(www.EdujiniOnline.com\)
Guest
Posts: n/a
 
      11-21-2006
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" <(E-Mail Removed)> wrote in message news:eWto$(E-Mail Removed)...
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 Removed)
http://www.nathansokalski.com/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
No parameterless constructor error for dataview Julia B ASP .Net 8 11-21-2008 02:56 PM
A constructor calling another constructor (default constructor)? Generic Usenet Account C++ 10 11-28-2007 04:12 AM
Newbie: does not have a parameterless constructor vncntj ASP .Net Web Services 1 11-25-2007 01:14 AM
#if (defined(__STDC__) && !defined(NO_PROTOTYPE)) || defined(__cplusplus) Oodini C Programming 1 09-27-2005 07:58 PM
machine control script ( parameterless method? ) simon place Python 4 03-07-2004 11:31 PM



Advertisments