Thanks to all for the excellent advice. After looking at my code, I found that I had all of the parameterless default constructors, but what I had forgotten to do was to call the base class. So now, it seems that most of my problem is fixed.
However, there are still a few which don't work. In these, I am getting an error message: "object reference not set to an instance of an object". I am hoping to use the design time debug advised but haven't done it yet. I have a "Windows Forms programming with C#" book, but it's written by Erik Brown. Did you get the author wrong or do I have the wrong book? DG -----Original Message----- From: Unmoderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Jain, Aman Sent: Friday, August 27, 2004 1:42 PM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] [SPAM] - Re: [ADVANCED-DOTNET] Extending C# .NET Forms and con trols through inheritance - Bayesian Filter detected s pam Hi, Sometimes I use the following check: if(LicenseManager.UsageMode != LicenseUsageMode.Designtime) { InitializeControl(); } The control (Component class) itself has a DesignMode property but that doesn't work in certain scenarios (nested controls). May be somebody in the list can throw further light on Component.DesignMode vs LicenseManager.UsageMode. If you need to place a break point and debug a control at design time (when you drop a control on the form), it can be done by using the steps outlined in Chris sells' wonderful book ,"Windows Forms programming in C#". It is an excellent book for all winforms topics including Controls. Hope that helps Aman Jain -----Original Message----- From: John Bergman [mailto:[EMAIL PROTECTED] Sent: Friday, August 27, 2004 3:44 PM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] [SPAM] - Re: [ADVANCED-DOTNET] Extending C#.NET Forms and con trols through inheritance - Bayesian Filter detected spam Lots of controls also check to see if they are being accessed in 'DesignMode' or 'DesignTime' (I can't remember the property at the moment), and alter their behavior accordingly. -----Original Message----- From: Unmoderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Block, Jeffrey A. (Jeff) Sent: Friday, August 27, 2004 5:53 AM To: [EMAIL PROTECTED] Subject: [SPAM] - Re: [ADVANCED-DOTNET] Extending C#.NET Forms and controls through inheritance - Bayesian Filter detected spam Dana, Typically, I have seen this when a derived control can not be constructed. The biggest cuplrit I have uncovered is not having a parameterless, default constructor. If not you don't know this, the designer doesn't know what to pass to the constructor and therefore, can not create an instance of your control. If this is the case, just put in one for the designer's sake. HTH, Jeff Block -----Original Message----- From: Dana Thomas Gehm [mailto:[EMAIL PROTECTED] Sent: Friday, August 27, 2004 2:09 AM To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] Extending C#.NET Forms and controls through inheritance I'm trying to extend some .NET forms and controls like Form, TextBox and ComboBox to add some capabilties to my application, specifically, I want to have the derived class insert the TextBox and ComboBox data directly from an ADO.NET DataRow in the Form Load event and copy into an ADO.NET DataRow in the Control Leave event. The code compiles correctly and seems to work, and the Forms designer worked for a while. But then I started getting the following message: "The designer could not be shown for this file because none of the classes within it can be designed". There is a Microsoft Knowledge Article 815325 which mentions this, but it's solution didn't help me. I also saw on the web advice to comment out code in the OnLoad, that didn't help either. There seems to be some bug in Visual Studio here but I haven't figured out how to get around it. DG =================================== This list is hosted by DevelopMentor(r) http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with CSharp August 30 - September 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com ----------------------------------------- ********************************************************************** PLEASE NOTE: The above email address has recently changed from a previous naming standard -- if this does not match your records, please update them to use this new name in future email addressed to this individual. This message and any attachments are intended for the individual or entity named above. If you are not the intended recipient, please do not forward, copy, print, use or disclose this communication to others; also please notify the sender by replying to this message, and then delete it from your system. The Timken Company ********************************************************************** =================================== This list is hosted by DevelopMentor(r) http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with CSharp August 30 - September 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor(r) http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with CSharp August 30 - September 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorR http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with CSharp August 30 - September 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorŪ http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with CSharp August 30 - September 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com