Rousseau Sennett

Rousseau Sennett

  • NA
  • 31
  • 43.9k

c# User Control Text Property Override

Mar 18 2014 5:36 AM

Hi

I've looked online and played around allot but can't seem to find a solution

I made a custom user control that has a textbox & Lable inside of it. All I wanted to do was to override the Text property of the user control to point to the text property of the inner textbox… seems simple enough but it just doesn’t work. I found allot of topics online from people with the same problem but no solution. When I create a new property named “Value” with exactly the same code it works fine. Any assistance would be appreciated.

 

[Browsable(true)]

[Bindable(true)]

public override string Text

{

get

{

return txtInner.Text;

}

set

{

txtInner.Text = value;

}

}

 
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

{

 

 

return txtInner.Text;

}

 

 

set

 

 

{

 

 

txtInner.Text = value;

}

 

 

}

 
 

Answers (7)