Udostępnij za pośrednictwem


ListObject.Parent Property

Definition

Gets the parent object of the ListObject control.

public:
 property System::Object ^ Parent { System::Object ^ get(); };
public object Parent { get; }
member this.Parent : obj
Public ReadOnly Property Parent As Object

Property Value

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 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());
}
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

Applies to