Add property to Custom Control

  • Thread starter Thread starter Keith Smith
  • Start date Start date
K

Keith Smith

I wrote a custom control that inherits its structure from a textBox. Is it
possible for me to add my own property so that the end-user can change it
when he is using the control in his app?

I want to have a property called "Mask" which the user can set to "true" or
"false". Then when the user sets it then a variable called "varMask" is set
to either true or false.
 
Sure...

public class foo: TextBox

{

int _mask;

public int Mask

{

get{return _mask;}

set{_mask=value;}

}



}


--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Back
Top