473,480 Members | 3,021 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 1647
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
1355
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
2074
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
3946
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
2420
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
1493
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
1023
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
914
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
697
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
2960
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
7055
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6920
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6760
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5365
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4501
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3004
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1311
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.