In the C # language, the properties of a radio box are really similar to other programming languages.
The main attributes are:Name,Text. The main thing is:checkedchanged.
For example: Create a simple example, choose Spring and Autumn. You can simply select the RadioButton component and pull out 4 boxes on top of the window . Then, modify the Text Property individually: Spring, summer, autumn, winter. Interface such as:
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/08/92/wKiom1nkVBDivQA_AAATuAkoCFA543.png-wh_500x0-wm_ 3-wmp_4-s_874568319.png "title=" 1.png "alt=" Wkiom1nkvbdivqa_aaatuakocfa543.png-wh_50 "/>
Next, you can set the checkedchanged event for each radio box component separately .
The code is as follows:
void radiobutton1checkedchanged(Objectsender,EventArgse)
{
MessageBox.Show(RadioButton1. Text);
}
void radiobutton2checkedchanged(Objectsender,EventArgse)
{
MessageBox.Show(RadioButton2. Text);
}
void radiobutton3checkedchanged(Objectsender,EventArgse)
{
MessageBox.Show(RadioButton3. Text);
}
void radiobutton4checkedchanged(Objectsender,EventArgse)
{
MessageBox.Show(RadioButton4. Text);
}
This article is from the "Smile" blog, please be sure to keep this source http://yiyiweixiao.blog.51cto.com/2476874/1972801
28. RadioButton properties and events of the radio box inside C #