473,372 Members | 921 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

derived usercontrol

Is there any possibility to create a usercontrol deriving from an
abstract usercontrol?
I could only achieve it by editing the code from "MyControl :
System.Windows.Forms.UserControl" to "MyControl : MyAbstractControl" by
hand.
MyAbstractControl is declared abstract and it is derived from
System.Windows.Forms.UserControl.
If I do that, the controls cannot be displayed anymore in the designer.

What can I do to get around this problem

Thanks
Ferdinand
Dec 15 '05 #1
2 1643
Hi Ferdinand,

You will need to create a custom Designer for your Control.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Ferdinand Zaubzer" <fe***************@schendl.at> wrote in message
news:eQ*************@TK2MSFTNGP15.phx.gbl...
Is there any possibility to create a usercontrol deriving from an abstract
usercontrol?
I could only achieve it by editing the code from "MyControl :
System.Windows.Forms.UserControl" to "MyControl : MyAbstractControl" by
hand.
MyAbstractControl is declared abstract and it is derived from
System.Windows.Forms.UserControl.
If I do that, the controls cannot be displayed anymore in the designer.

What can I do to get around this problem

Thanks
Ferdinand

Dec 15 '05 #2
In order to design your derived control, the Designer must first create
an instance of the base control class at design time. Since you've
declared the base abstract, it can't do that, so it can't provide you
with a design surface to work on.

So, no, you can't design controls derived from abstract classes.

The closest you can come is to test the DesignMode property in your
base calss (after your constructor... typically in your OnLoad method
or something like that) and, if it's false, throw an
InvalidOperationException. That way you know that your base class will
never be instantiated at run time.

Dec 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Sebastian Ferreyra | last post by:
Hi, I'm writng a control derived from UserControl (let's call this control MyControl) that itself is meant to be derived further times. MyControl hosts a public collection of specialized...
2
by: John B | last post by:
Hello I want to create a set of controls that have some common methods and properties. I was thinking that I should subclass the UserControl class and add these common features there and then...
3
by: ZhangZQ | last post by:
Supposing I have a class "UserControl1 : System.Windows.Forms.UserControl" in an Assembly "UI.dll", now I create an Application project and want to use the "UserControl1" in another AppDomain, ...
4
by: Dennis | last post by:
I am trying to set the default design proerties in a control I have derived from the Panel Class. I thought I'd found how to do it from the MSDN but the following line doesn't work: Inherits...
7
by: Dennis | last post by:
I have a control that inherits from the Panel Class. To this, I added a label which I want to use as a caption in my derived control. However, I can't get the label to show up in the panel. I...
0
by: Captain Sensible | last post by:
Hello! I created a master page and load usercontrols dynmamically during runtime. So far so good. But for getting a unique frame with functionality buttons like Add, save etc. I created a...
0
by: --== Alain ==-- | last post by:
Hi, i would like to improve the .NET control named ListView. for that i would need to display (quite) all properties and methods of ..NET ListView control to user and also to add my own. ...
2
by: she_prog | last post by:
I have a class derived from UserControl. I need to serialize an object of this class, but only some properties of it, as not all properties are serializable (some of the properties coming from...
3
by: zhaodapu | last post by:
I derived a panel class: public class DeskPanel : System.Windows.Forms.Panel Now I want to use the visual designer to add controls in MyPanel class. But I noticed that the visual designer...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.