PC Review


Reply
Thread Tools Rate Thread

Add property to Custom Control

 
 
Keith Smith
Guest
Posts: n/a
 
      16th Feb 2005
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.


 
Reply With Quote
 
 
 
 
Bob Powell [MVP]
Guest
Posts: n/a
 
      16th Feb 2005
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.





"Keith Smith" <(E-Mail Removed)> wrote in message
news:viGQd.35928$Dc.24916@trnddc06...
>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.
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Asp.net User Control or Custom control Property doesnt accept inlineasp.net constract <%= %> is there a workaround? AleXmanFree Microsoft ASP .NET 3 9th Oct 2008 08:39 PM
How do you access a control property of a main form from a custom user control? forest demon Microsoft C# .NET 6 22nd Aug 2007 11:36 PM
feeding a SQLDataSource embedded in an .ascx user control a custom property assigned to that control Microsoft ASP .NET 4 16th Jul 2006 01:20 PM
can a custom control have an image property that can be set in design time from the property browser? news.austin.rr.com Microsoft Dot NET Compact Framework 3 3rd Mar 2005 02:08 AM
Custom Control Property HelpText Property =?Utf-8?B?R3JleUFsaWVuMDA3?= Microsoft Dot NET Framework Forms 1 20th Jan 2005 06:17 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:05 AM.