|
-
Nov 15th, 2007, 10:06 AM
#1
Creating custom controls?
I've found need for a certain functionality several times thus far... namely, a check box that controls the enabled state of a text box. Granted, making the code for this isn't very difficult. But I'm wondering... what would I do to make a new control for it? Call it, say, CheckTextBox. It would hold many (but not all) properties of both check boxes and text boxes. Any starters?
Please keep in mind that I've never tried to make my own controls before, and C# still isn't my primary language.
-
Nov 15th, 2007, 07:11 PM
#2
Re: Creating custom controls?
You would create a UserControl, add a CheckBox and a TextBox, then add properties as pass-throughs for the properties of the child controls, e.g.
CSharp Code:
public bool Checked
{
get { return this.checkBox1.Checked; }
set { this.checkBox1.Checked = value }
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|