Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subclass User Control
Message
 
À
19/06/2008 09:54:48
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01323501
Message ID:
01325436
Vues:
19
Sorry. Just having a dense moment.


>>What would be nice is to create a base container control, then subclass it for other uses. I'm not sure how to go about this.
>
>Isn't that what I just showed you? MyBaseControl is a base container control and MySubControl is a sub-class of it. I don't understand what you don't understand ...
>
>~~Bonnie
>
>>>Well, it depends on what you're sub-classing and what you want to do with it. If you have a UserControl class that you want to sub-class, you can do a lot of it visually if you need to. So, say you have this UserControl:
>>>
>>>
>>>public class MyBaseControl : System.Windows.Forms.UserControl
>>>{
>>>   // code in here
>>>}
>>>
>>>
>>>Now, to sub-class it, you start out by doing it in code: Add a new class to your project, make it of type UserControl, then go into the code and change it from this:
>>>
>>>
>>>public class MySubControl : System.Windows.Forms.UserControl
>>>
>>>
>>>to this:
>>>
>>>
>>>public class MySubControl : MyBaseControl
>>>
>>>
>>>At this point you can open your new sub-class up in the designer.
>>>
>>>~~Bonnie
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform