Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User Control / Derived Control

Status
Not open for further replies.

bernardmanning

Programmer
Oct 14, 2003
61
GB
Hi,

I have a need to create a reusable group control that contains 3 radio buttons.

I need to be able to drop this control on any win form, so a user control sounds ideal.

The problem is that I need to be able to allow the user to change the text property against the radio buttons.

But, I can't get access via the designer to change the text property for each radio button.

Do I need to use a derived control? or can I do this this using a user control?

Thanks, Bernard....

 
expose the Text properties of the radio buttons as public properties of the user control:

Code:
public class RadioGroup : UserControl
{
public string RadioText1
{
 get { return radio1.Text; }
 set { radio1.Text = value; }
}
// ...
}

this way the text can be changed at design time, too.
if you want the user to be able to change the text at runtime you'll have to collect the text somewhere else, on an options page, maybe.
if you want them to be able to change the text and the selected radio button at the same time on the same form then radio buttons is not what you need. really, rethink it.
hth,


mr s. <;)

 
Thanks, Mr Stick....

It's going to sound bad, but that the way I had approached the problem, but didn't know if it was acceptable..

Many thanks for the confirmation....

Bernard.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top