2

I have a radio button called radiobutton1. I wrote the code below in Form1.cs after creating the button from toolbox in Form1.cs[design]:

private void radiobutton1_checkchanged(object sender, EventArgs e)
{
    flag object = 2;
    flag_P = 0;
    n_objA = int.parse(objD_n.text);
}

However on top of private void it says, 0 references. When I double-click radiobutton1 in Form1.cs[design], the following code emerges in Form1.cs:

private void radiobutton1_checkchanged_1(object sender, EventArgs e)
{

}

The text above private void states that this has 1 reference.

How come the code I wrote has no reference and how do I connect this code to the radio button?

Atom Scott
  • 59
  • 1
  • 10

2 Answers2

2
  1. Select your radio button in design mode

  2. see the property window

  3. click the event button

  4. that's it

enter image description here

J.C
  • 633
  • 1
  • 13
  • 27
0

Go to the Designer view, select Properties of your radiobutton1, then select Events tab:

Actually you have created 2 events for CheckedChanged. Now from the dropdown list simply select the button1_checkchanged and it will be subscribed:

enter image description here

Shaharyar
  • 12,254
  • 4
  • 46
  • 66