This documentation is archived and is not being maintained.

Control.EnabledChanged Event

Occurs when the Enabled property value has changed.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public event EventHandler EnabledChanged

This event is raised if the Enabled property is changed by either a programmatic modification or user interaction.

For more information about handling events, see Consuming Events.

The following code example uses two RadioButton controls to demonstrate the EnabledChanged event. Clicking one button changes the value of the Enabled property of the other button to false and displays a MessageBox.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

public class Form1 : Form
    private RadioButton radioButton1;
    private RadioButton radioButton2;

    public Form1()
    static void Main()
        Application.Run(new Form1());

    private void InitializeComponent()
        this.radioButton1 = new System.Windows.Forms.RadioButton();
        this.radioButton2 = new System.Windows.Forms.RadioButton();
        // radioButton1 
        this.radioButton1.AutoSize = true;
        this.radioButton1.Location = new System.Drawing.Point(0, 0);
        this.radioButton1.Name = "radioButton1";
        this.radioButton1.Size = new System.Drawing.Size(62, 17);
        this.radioButton1.TabIndex = 0;
        this.radioButton1.TabStop = true;
        this.radioButton1.Text = "Button1";
        this.radioButton1.UseVisualStyleBackColor = true;
        this.radioButton1.EnabledChanged += new System.EventHandler(this.radioButton1_EnabledChanged);
        // radioButton2 
        this.radioButton2.AutoSize = true;
        this.radioButton2.Location = new System.Drawing.Point(0, 39);
        this.radioButton2.Name = "radioButton2";
        this.radioButton2.Size = new System.Drawing.Size(100, 17);
        this.radioButton2.TabIndex = 1;
        this.radioButton2.TabStop = true;
        this.radioButton2.Text = "Disable Button1";
        this.radioButton2.UseVisualStyleBackColor = true;
        this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged);
        // Form1 
        this.ClientSize = new System.Drawing.Size(292, 273);
        this.Name = "Form1";


    private void radioButton2_CheckedChanged(object sender, EventArgs e)
        radioButton1.Enabled = false;

    private void radioButton1_EnabledChanged(object sender, EventArgs e)
        MessageBox.Show("This button has been disabled.");

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

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

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0