ListObject.Parent Property

Gets the parent object of the ListObject control.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)

Syntax

'Declaration
ReadOnly Property Parent As Object
    Get
Object Parent { get; }

Property Value

Type: System.Object
The parent object of the ListObject control.

Examples

The following code example creates a ListObject and then displays the name of its parent object in a message.

This example is for a document-level customization.

    Private Sub ListObject_Parent()
        Dim List1 As Microsoft.Office.Tools.Excel.ListObject = _
            Me.Controls.AddListObject(Me.Range("A1", "C4"), "List1")

        Dim List1Parent As Excel.Worksheet = _
            CType(List1.Parent, Excel.Worksheet)
        MessageBox.Show("The parent of List1 is " & _
            List1Parent.Name.ToString())
    End Sub

private void ListObject_Parent()
{
    Microsoft.Office.Tools.Excel.ListObject list1 =
        this.Controls.AddListObject(
        this.Range["A1", "C4"], "list1");

    Excel.Worksheet list1Parent = (Excel.Worksheet)list1.Parent;
    MessageBox.Show("The parent of list1 is " +
        list1Parent.Name.ToString());
}

.NET Framework Security

See Also

Reference

ListObject Interface

Microsoft.Office.Tools.Excel Namespace