ParentRowsVisibleChanged Event

DataGrid.ParentRowsVisibleChanged Event

Occurs when the ParentRowsVisible property value changes.

[Visual Basic]
Public Event ParentRowsVisibleChanged As EventHandler
public event EventHandler ParentRowsVisibleChanged;
public: __event EventHandler* ParentRowsVisibleChanged;

[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.


For more information about handling events, see Consuming Events.


[Visual Basic] 
Private Sub CallParentRowsVisibleChanged()
   AddHandler myDataGrid.ParentRowsVisibleChanged, AddressOf _
End Sub 'CallParentRowsVisibleChanged

' Set the 'ParentRowsVisible' property on click of a button.
Protected Sub ToggleVisible_Clicked(sender As Object, e As EventArgs)
   If myDataGrid.ParentRowsVisible = True Then
      myDataGrid.ParentRowsVisible = False
      myDataGrid.ParentRowsVisible = True
   End If
End Sub 'ToggleVisible_Clicked
' raise the event when 'ParentRowsVisible' property is changed.
Protected Sub DataGridParentRowsVisibleChanged_Clicked(sender As Object, e As EventArgs)
   Dim myMessage As String = "ParentRowsVisibleChanged event raised, Parent row is : "
   Dim visible As Boolean = myDataGrid.ParentRowsVisible
   myMessage += IIF(visible," ", "Not") + "Visible"
   MessageBox.Show(myMessage, "ParentRowsVisible information")
End Sub 'DataGridParentRowsVisibleChanged_Clicked

private void CallParentRowsVisibleChanged()
   myDataGrid.ParentRowsVisibleChanged +=
      new EventHandler(DataGridParentRowsVisibleChanged_Clicked);

// Set the 'ParentRowsVisible' property on click of a button.
protected void ToggleVisible_Clicked(object sender, EventArgs e)
   if (myDataGrid.ParentRowsVisible == true)
      myDataGrid.ParentRowsVisible = false;
      myDataGrid.ParentRowsVisible = true;

// raise the event when 'ParentRowsVisible' property is changed.
protected void DataGridParentRowsVisibleChanged_Clicked(object sender, EventArgs e)
   string myMessage = "ParentRowsVisibleChanged event raised, Parent row is : ";
   bool visible = myDataGrid.ParentRowsVisible;
   myMessage += (visible ? " " : " NOT ") + "visible";

   MessageBox.Show(myMessage, "ParentRowsVisible information");

    void CallParentRowsVisibleChanged() {
        myDataGrid->ParentRowsVisibleChanged += 
            new EventHandler(this, &MyForm::DataGridParentRowsVisibleChanged_Clicked);

    // Set the 'ParentRowsVisible' property on click of a button.
    void ToggleVisible_Clicked(Object* /*sender*/, EventArgs* /*e*/) {
        if (myDataGrid->ParentRowsVisible == true)
            myDataGrid->ParentRowsVisible = false;
            myDataGrid->ParentRowsVisible = true;

    // raise the event when 'ParentRowsVisible' property is changed.
    void DataGridParentRowsVisibleChanged_Clicked(Object* /*sender*/, EventArgs* /*e*/) {
        String* myMessage = S"ParentRowsVisibleChanged event raised, Parent row is : ";
        bool visible = myDataGrid->ParentRowsVisible;
        myMessage = String::Concat(myMessage, visible ? S" " : S" NOT ", S"visible");

        MessageBox::Show(myMessage, S"ParentRowsVisible information");

[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.


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

© 2016 Microsoft