RadioButton.CheckedChanged Event
Occurs when the value of the Checked property changes.
[Visual Basic] Public Event CheckedChanged As EventHandler [C#] public event EventHandler CheckedChanged; [C++] public: __event EventHandler* CheckedChanged;
[JScript] In JScript, you can handle the events defined by a class, but you cannot define your own.
Event Data
The event handler receives an argument of type EventArgs.
Remarks
For more information about handling events, see Consuming Events.
Example
[Visual Basic, C#, C++] The following example demonstrates how the CheckAlign property can be changed at run time. The check box portion of a radio button control is moved to the right or left of the text when the Checked value changes. This code assumes that a RadioButton control has been instantiated on a form and that a reference to the System.Drawing namespace has been included.
[Visual Basic] Private Sub radioButton1_CheckedChanged(sender As Object, e As EventArgs) ' Change the check box position to be opposite its current position. If radioButton1.CheckAlign = ContentAlignment.MiddleLeft Then radioButton1.CheckAlign = ContentAlignment.MiddleRight Else radioButton1.CheckAlign = ContentAlignment.MiddleLeft End If End Sub [C#] 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; } } [C++] private: System::Void radioButton1_CheckedChanged(System::Object * sender, System::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; } } };
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also
RadioButton Class | RadioButton Members | System.Windows.Forms Namespace | Checked | OnCheckedChanged