Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subclassing a subclass
Message
De
06/10/2007 19:53:10
 
 
À
04/10/2007 20:52:40
Alan Harris-Reid
Baseline Data Services
Devon, Royaume Uni
Information générale
Forum:
ASP.NET
Catégorie:
Conception classe
Divers
Thread ID:
01256172
Message ID:
01259212
Vues:
11
Alan,

Do the same thing as you did for Font in your base class, override the Text property.
	public override string Text
	{
		get { return base.Text; }
		set { base.Text = "Edit"; }
	}
~~Bonnie


>>I dragged the above class from the toolbox onto a form and ran the form in debug mode. No errors occurred, but the button shows "cEditButton1" as the Text, not "Edit". Any ideas what might be going wrong?
>>
>
>Ok, I've found what is causing the above error. When I drag the button class onto a form, VS automatically sets the button text to "cEditButton1", the next button as "cEditButton2", etc.. If I blank-out the text (via. the property sheet) and run the form, I get "Edit" as the button text, as set by the constructor method. This is fine at runtime, but I want to see the "Edit" text on the button at design-time (as we used to do in good ol' VFP), not a blank button! How can I get the required text immediately I drop the button on the form (apart from changing each instance manually, which to me defeats the object of having a class in the first place)?
>
>Any help would be appreciated.
>
>Alan
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