Export (0) Print
Expand All

RadioButton.CheckedChanged Event

Occurs when the value of the Checked property changes.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public event EventHandler CheckedChanged
/** @event */
public void add_CheckedChanged (EventHandler value)

/** @event */
public void remove_CheckedChanged (EventHandler value)

JScript supports the use of events, but not the declaration of new ones.

For more information about handling events, see Consuming Events.

The following code example demonstrates how the CheckAlign property can be changed at run time. The check box portion of a RadioButton is moved to the right or left of the text when the Checked value changes. This example requires that a RadioButton control has been instantiated on a form and that a reference to the System.Drawing namespace has been included.

private void radioButton1_CheckedChanged(Object sender, 
                                         EventArgs e)
{
   // Change the check box position to be opposite its current position.
   if (radioButton1.CheckAlign == ContentAlignment.MiddleLeft)
   {
      radioButton1.CheckAlign = ContentAlignment.MiddleRight;
   }
   else
   {
      radioButton1.CheckAlign = ContentAlignment.MiddleLeft;
   }
}


private void radioButton1_CheckedChanged(Object sender, EventArgs e)
{
    // Change the check box position to be opposite its current position.
    if (radioButton1.get_CheckAlign().Equals(ContentAlignment.MiddleLeft)) {
        radioButton1.set_CheckAlign(ContentAlignment.MiddleRight);
    }
    else {
        radioButton1.set_CheckAlign(ContentAlignment.MiddleLeft);
    }
} //radioButton1_CheckedChanged

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2015 Microsoft