please have a look at the following code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace calc
{
public partial class Form1 : Form
{
//code removed
public Form1()
{
InitializeComponent();
calculator = new Calculator();
maleRadio.PerformClick();
englishRadio.PerformClick();
}
/*code removed*/
//Action Listener for Female Radio button
private void femaleRadio_CheckedChanged(object sender, EventArgs e)
{
//code removed
}
//Action Listener for English Radio button
private void englishRadio_CheckedChanged(object sender, EventArgs e)
{
//code removed
}
}
}
I am somewhat new to c#. what I want to do here is to trigger the event handlers
of radio buttons inside the constructor programatically. The way I followed maleRadio.PerformClick();
do nothing. how can I call the event handlers inside the constructor programmertically ?
PerformClick
but want to handleCheckedChanged
. Eren Ersönmez answer should work :) – Aerugo