DataGridColumnStyle.ReadOnlyChanged Event


Occurs when the ReadOnly property value changes.

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

public event EventHandler ReadOnlyChanged

The following code example demonstrates the use of this member.

private void Button_Click(Object sender, EventArgs e)
   if (myButton.Text == "Make column read/write")
      myDataGridColumnStyle.ReadOnly = false;
      myButton.Text = "Make column read only";
      myDataGridColumnStyle.ReadOnly = true;
      myButton.Text = "Make column read/write";

private void AddCustomDataTableStyle()
   myDataGridTableStyle = new DataGridTableStyle();
   myDataGridTableStyle.MappingName = "Customers";
   myDataGridColumnStyle = new DataGridTextBoxColumn();
   myDataGridColumnStyle.MappingName= "CustName";
   // Add EventHandler function for readonlychanged event.
   myDataGridColumnStyle.ReadOnlyChanged += new EventHandler(myDataGridColumnStyle_ReadOnlyChanged);
   myDataGridColumnStyle.HeaderText = "Customer";
   // Add the 'DataGridTableStyle' instance to the 'DataGrid'.
private void myDataGridColumnStyle_ReadOnlyChanged(Object sender, EventArgs e)
   MessageBox.Show("'Readonly' property is changed");

.NET Framework
Available since 1.1
Return to top