This documentation is archived and is not being maintained.

DataGrid.FlatModeChanged Event

Occurs when the FlatMode has changed.

[Visual Basic]
Public Event FlatModeChanged As EventHandler
[C#]
public event EventHandler FlatModeChanged;
[C++]
public: __event EventHandler* FlatModeChanged;

[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] 
' Check if the 'ReadOnly' property is changed.
Private Sub myDataGrid_ReadOnlyChanged(ByVal sender As Object, ByVal e As EventArgs) Handles myDataGrid.ReadOnlyChanged
    Dim strMessage As String = "false"
    If myDataGrid.ReadOnly = True Then
        strMessage = "true"
    End If
    MessageBox.Show("Read only changed to " + strMessage, "Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Sub 'myDataGrid_ReadOnlyChanged

' Toggle the 'ReadOnly' property.
Private Sub button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button2.Click
    If myDataGrid.ReadOnly = True Then
        myDataGrid.ReadOnly = False
    Else
        myDataGrid.ReadOnly = True
    End If
End Sub 'button2_Click

[C#] 
// Attach to event handler.
private void AttachReadOnlyChanged()
{
   this.myDataGrid.ReadOnlyChanged += new EventHandler(this.myDataGrid_ReadOnlyChanged);
}
// Check if the 'ReadOnly' property is changed.
private void myDataGrid_ReadOnlyChanged(object sender, EventArgs e)
{   
   string strMessage = "false";
   if(myDataGrid.ReadOnly == true)
      strMessage = "true";

   MessageBox.Show("Read only changed to "+strMessage,
      "Message",   MessageBoxButtons.OK,
      MessageBoxIcon.Exclamation);         
}
// Toggle the 'ReadOnly' property.
private void button2_Click(object sender, EventArgs e)
{
   if(myDataGrid.ReadOnly == true)
      myDataGrid.ReadOnly = false;
   else
      myDataGrid.ReadOnly = true;
}      

[C++] 
private:
    // Attach to event handler.
    void AttachReadOnlyChanged() {
        this->myDataGrid->ReadOnlyChanged += 
            new EventHandler(this, &MyDataGridClass_FlatMode_ReadOnly::myDataGrid_ReadOnlyChanged);
    }

    // Check if the 'ReadOnly' property is changed.
    void myDataGrid_ReadOnlyChanged(Object* /*sender*/, 
        EventArgs* /*e*/) {
            String* strMessage = S"false";
            if (myDataGrid->ReadOnly == true)
                strMessage = S"true";

            MessageBox::Show(String::Concat(S"Read only changed to ", 
                strMessage), S"Message", MessageBoxButtons::OK,
                MessageBoxIcon::Exclamation);
    }

    // Toggle the 'ReadOnly' property.
    void button2_Click(Object* /*sender*/, EventArgs* /*e*/) {
        if (myDataGrid->ReadOnly == true)
            myDataGrid->ReadOnly = false;
        else
            myDataGrid->ReadOnly = true;
    }

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter 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

DataGrid Class | DataGrid Members | System.Windows.Forms Namespace | FlatMode

Show: