deepankar
how can i write code for radio buttons in visual c#.net?
By deepankar in Windows Forms on Apr 24 2008
  • sudipto chatterjee
    Apr, 2008 24

    Initialize two radio buttons:'Yes' & 'No' in the windows form:

    private System.Windows.Forms.RadioButton rdbtnYes;

    private System.Windows.Forms.RadioButton rdbtnNo;

    Next when you double click on either of two radio buttons you will see the below code will appear in vs 2003 editor:

    private void rdbtnYes_CheckedChanged(object sender, EventArgs e)

    {

    if( rdbtnYes.Checked == true)

    {

    MessageBox.Show("Yes"); // Will show if you check the "Yes" radio button

    }

    }

    private void rdbtnNo_CheckedChanged(object sender, EventArgs e)

    {

    if( rdbtnNo.Checked == true)

    {

    MessageBox.Show("No"); // Will show if you check the "No" radio button

    }

    }

    that's all.happy coding

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS