Newbie - User Control hide property

  • Thread starter Thread starter Anurag Agarwal
  • Start date Start date
A

Anurag Agarwal

I am creating a control in which I inherit from Label

public class WZFormLabel : Label

I would like to hide certain properties like Font, TextAlign etc. I
have tried the following code, but it throws an error

[Browsable(false)]
public override Font Font
{
get
{
return this.Font;
}
set
{
this.Font = value;
}
}

What am I doing wrong ?

Thanks
 
Hi,
I am creating a control in which I inherit from Label

public class WZFormLabel : Label

I would like to hide certain properties like Font, TextAlign etc. I
have tried the following code, but it throws an error

[Browsable(false)]
public override Font Font
{
get
{
return this.Font;
}
set
{
this.Font = value;
}
}

What am I doing wrong ?

Your problem is not a *Browsable* attribute but a word *this* in your
property definition!
Change *this* to *base* and it should work!
:)

Regards

Marcin
 
Back
Top