3
Answers

c# new modifier

rudi 0

rudi 0

20y
2.9k
1
Hi Guys, I'm having a few problems getting the new modifier to work on a usercontrol. I am trying to hide (or shadow, in VB terms) the 'Enabled' property of a usercontrol so that i can do funky stuff with it when it is disabled. However, it is not hitting my method .... it is disabling the usercontrol, but does not hit my method? has anyone else had this issue?? or has anyone got any ideas as to why this is happening?? Here is my method: new public bool Enabled { get { return txtWebAddress.Enabled; } set { this.TabStop = value; txtWebAddress.Enabled = value; btnLaunchUrl.Enabled = value; if(!value) { txtWebAddress.BackColor = Color.FromKnownColor (ColorConsts.COLOR_READONLY); btnLaunchUrl.BackColor = Color.FromKnownColor (ColorConsts.COLOR_READONLY); } else { txtWebAddress.BackColor = this.BackColor; btnLaunchUrl.BackColor = this.BackColor; } } } It doesn't make any difference if i try putting the new before or after the public keyword. I am setting the property by looping through all the conytrols on a form and setting their enabled property, polymorphism should make this happen... shoudl it not??? Thanks Ian Moores
Answers (3)