RadioButton

  • Thread starter Radiobutton via DotNetMonster.com
  • Start date
R

Radiobutton via DotNetMonster.com

i need help with radiobuttons.

i am useing 1button and 2 radiobuttons i am trying to make it so when u
select a radiobutton and hit button1 it will clear radiobuttons 1 and 2.
 
M

Martijn Mulder

i need help with radiobuttons.
i am useing 1button and 2 radiobuttons i am trying to make it so when u
select a radiobutton and hit button1 it will clear radiobuttons 1 and 2.




//namespace RadioButton
namespace RadioButton
{

using System;
using System.Drawing;
using System.Windows.Forms;


//class Form
class Form:System.Windows.Forms.Form
{

//create 3 RadioButtons
RadioButton radiobutton1=new RadioButton();
RadioButton radiobutton2=new RadioButton();
RadioButton radiobutton3=new RadioButton();


//create a Button
Button button=new Button();


//constructor
Form()
{

//set Text of the RadioButtons
radiobutton1.Text="RadioButton 1";
radiobutton2.Text="RadioButton 2";
radiobutton3.Text="RadioButton 3";


//set Text of the Button
button.Text="Reset";


//set EventHandler for the Button
button.Click+=new EventHandler(Button_Click);


//set Location of the RadioButtons
radiobutton1.Location=new Point(34,5);
radiobutton2.Location=new Point(34,26);
radiobutton3.Location=new Point(34,47);


//set Location of the Button
button.Location=new Point(34,68);


//add the RadioButtons to the Form
Controls.Add(radiobutton1);
Controls.Add(radiobutton2);
Controls.Add(radiobutton3);


//add the Button to the Form
Controls.Add(button);
}


//Button_Click
void Button_Click(object a,EventArgs b)
{
radiobutton1.Checked=false;
radiobutton2.Checked=false;
radiobutton3.Checked=false;
}


//Main
[STAThreadAttribute]
public static void Main(string[] args)
{
Application.Run(new Form());
}
}
}
 
C

C# Dragon via DotNetMonster.com

Martijn said:
i need help with radiobuttons.

i am useing 1button and 2 radiobuttons i am trying to make it so when u
select a radiobutton and hit button1 it will clear radiobuttons 1 and 2.

//namespace RadioButton
namespace RadioButton
{

using System;
using System.Drawing;
using System.Windows.Forms;

//class Form
class Form:System.Windows.Forms.Form
{

//create 3 RadioButtons
RadioButton radiobutton1=new RadioButton();
RadioButton radiobutton2=new RadioButton();
RadioButton radiobutton3=new RadioButton();

//create a Button
Button button=new Button();

//constructor
Form()
{

//set Text of the RadioButtons
radiobutton1.Text="RadioButton 1";
radiobutton2.Text="RadioButton 2";
radiobutton3.Text="RadioButton 3";

//set Text of the Button
button.Text="Reset";

//set EventHandler for the Button
button.Click+=new EventHandler(Button_Click);

//set Location of the RadioButtons
radiobutton1.Location=new Point(34,5);
radiobutton2.Location=new Point(34,26);
radiobutton3.Location=new Point(34,47);

//set Location of the Button
button.Location=new Point(34,68);

//add the RadioButtons to the Form
Controls.Add(radiobutton1);
Controls.Add(radiobutton2);
Controls.Add(radiobutton3);

//add the Button to the Form
Controls.Add(button);
}

//Button_Click
void Button_Click(object a,EventArgs b)
{
radiobutton1.Checked=false;
radiobutton2.Checked=false;
radiobutton3.Checked=false;
}

//Main
[STAThreadAttribute]
public static void Main(string[] args)
{
Application.Run(new Form());
}
}
}

thx alot that helped ^_^
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top