Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Overriding properties in subclasses
Message
 
À
19/07/2006 11:52:33
Information générale
Forum:
ASP.NET
Catégorie:
Conception classe
Divers
Thread ID:
01137567
Message ID:
01137685
Vues:
22
Bonnie,

Thanks. That was one of the things I had tried, but that isn't the behavior I'm after. What I want is for the default value of the property to be DropDownList, but still be changeable at design-time by the developer. And if you right-click the property on the property sheet and click Reset, then I want it to be reset to DropDownList. I know this has to be possible and should be easy.

TIA,
Chad


>Chad,
>
>If you want the DropDownStyle to always be DropDownList, then set it in the constructor of the class rather
than try to override the property:
>
>using System;
>using System.Drawing;
>using System.Collections;
>using System.ComponentModel;
>using System.Windows.Forms;
>using System.Data;
>
>namespace MyCompany.WinUI.MyClasses
>{
>    public class MyComboBox : System.Windows.Forms.ComboBox
>    {
>        public MyComboBox()
>        {
>            // Override settings with new default values in the constructor.
>            this.DropDownStyle = ComboBoxStyle.DropDownList;
>        }
>    }
>}
>
>
>~~Bonnie
_________________________________
There are 2 types of people in the world:
    Those who need closure
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform