DataGridTableStyle.ReadOnlyChanged Event

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Occurs when the ReadOnly value changes.

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

public event EventHandler ReadOnlyChanged

For more information about handling events, see Handling and Raising Events.

The following code example demonstrates the use of this member.

protected void AddTableStyle()
{
   // Create a new DataGridTableStyle.
   myDataGridTableStyle = new DataGridTableStyle();
   myDataGridTableStyle.MappingName = myDataSet1.Tables[0].TableName;
   myDataGrid1.DataSource=myDataSet1.Tables[0];
   myDataGridTableStyle.ReadOnlyChanged+=new EventHandler(MyReadOnlyChangedEventHandler);
   myDataGrid1.TableStyles.Add(myDataGridTableStyle);
}

// Handle the 'ReadOnlyChanged' event.
private void MyReadOnlyChangedEventHandler(object sender, EventArgs e)
{
   MessageBox.Show("ReadOnly property is changed");
}

// Handle the check box's CheckedChanged event
private void myCheckBox1_CheckedChanged(object sender, EventArgs e)
{
   if(myDataGridTableStyle.ReadOnly)
   {
      myDataGridTableStyle.ReadOnly=false;
   }
   else
   {
      myDataGridTableStyle.ReadOnly=true;
   }
}

.NET Framework
Available since 1.1
Return to top
Show: