Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subclassing - NEWBIE!!
Message
De
12/03/2004 16:27:39
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00885724
Message ID:
00885816
Vues:
14
Shawn,

Let me add to Cathi's reply, as what I'm going to add is implied by Cathi's reply, but you may not realize it ... you can put more than one sub-classed control in one .cs or .vb file. For the simple sub-classes, like MyTextBox or MyComboBox, this is how I would do it ... they'd all be contained in MyCustomControls.cs (for example). For more complex composite controls, you'll probably want separate files (because a composite control *can* be designed visually), but you could still put them all into the same MyCustomControls project so they'd be all in the same DLL.

~~Bonnie



>Hi Cathi,
>
>Would i create a project to hold all the controls that i want to subclass? Do i ned to make a DLL for me to re-use in other projects?
>
>Shawn
>
>
>>Hi Shawn,
>>
>>You need to subclass .NET controls in code and not via the designer. Just create a new C# or VB.NET class and inherit from the control you want to inherit from. To use the control, you would add it to the toolbox and then drag it onto a form. Not as easy as FoxPro but you will get the same end result.
>>
>>>Very newbie questions!!!!
>>>
>>>How do I subclass an element and then tell be able to select my element?
>>>
>>>
>>>I have subclasses in VFP before but it was a matter of copying the object to a new VCX and then edit the code.
>>>
>>>I will also want to re-use this class in other projects as well, not just the one that I am working on.....
>>>
>>>
>>>Thanks in Advance
>>>
>>>Shawn Dorion
>>>Geo Sektor Dot Com
>>>Website: http://www.geosektor.com
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform