ControlCollection.AddListObject Method () (2007 System)
Adds a Visual Studio Tools for Office Microsoft.Office.Tools.Excel.ListObject to the control collection based on the specified native ListObject.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)
Syntax
'Declaration
Public Function AddListObject ( _
listObject As ListObject _
) As ListObject
'Usage
Dim instance As ControlCollection
Dim listObject As ListObject
Dim returnValue As ListObject
returnValue = instance.AddListObject(listObject)
public ListObject AddListObject(
ListObject listObject
)
public:
ListObject^ AddListObject(
ListObject^ listObject
)
public function AddListObject(
listObject : ListObject
) : ListObject
Parameters
listObject
Type: ListObjectThe native ListObject.
Return Value
Type: Microsoft.Office.Tools.Excel.ListObject
The Visual Studio Tools for Office Microsoft.Office.Tools.Excel.ListObject that was added to the control collection.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | The listObject argument is nulla null reference (Nothing in Visual Basic), or has zero length. |
ControlNameAlreadyExistsException | A ListObject control with the same name has already been added to the ControlCollection instance. |
Remarks
You should not call this method directly from your code. Instead, call the ListObjectExtensions.GetVstoObject extension method to obtain a Visual Studio Tools for Office Microsoft.Office.Tools.Excel.ListObject.
The ListObjectExtensions.GetVstoObject extension method uses this method to generate a Visual Studio Tools for Office Microsoft.Office.Tools.Excel.ListObject that corresponds to an instance of a native ListObject.
The ListObjectExtensions.GetVstoObject extension method creates an extended Microsoft.Office.Tools.Excel.ListObject only once. It returns the same instance of the existing extended object in subsequent calls. In contrast, AddListObject creates a new extended Microsoft.Office.Tools.Excel.ListObject each time.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.Office.Tools.Excel Namespace
Change History
Date |
History |
Reason |
---|---|---|
July 2008 |
New topic. |
SP1 feature change. |