ZennoLab Assemblies Documentation
Insert Method
See Also  Example Send Feedback
ZennoLab.CommandCenter Assembly > ZennoLab.CommandCenter Namespace > HtmlElementCollection Class : Insert Method
element

Type: Zennolab.CommandCenter.HtmlElement

The document to insert.

index

Type: System.Int32

The zero-based index at which html element should be inserted.

Glossary Item Box

Inserts a html element into the HtmlElementCollection at the specified index.

Syntax

C# 
public void Insert( 
   HtmlElement element,
   int index
)

Parameters

element

Type: Zennolab.CommandCenter.HtmlElement

The document to insert.

index

Type: System.Int32

The zero-based index at which html element should be inserted.

Exceptions

ExceptionDescription
ArgumentOutOfRangeExceptionindex is less than 0 or index is greater than Count.

Remarks

If index is equal to Count, item is added to the end of HtmlElementCollection.

Example

The following code example demonstrates the Insert method, along with various other properties and methods of the HtmlElementCollection.
C#Copy Code
// find elements by tag
HtmlElementCollection heCol = tab.FindElementsByTags("input:checkbox");
 
// find element by name
HtmlElement he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByName("rad");
 
// if collection is invalid then return -1
if ((heCol.IsVoid) || (heCol.ErrorDetected)) return -1;
 
// insert element to collection
heCol.Insert(he, 0);
PHPCopy Code
// find elements by tag
$heCol = $tab->FindElementsByTags("input:checkbox");
 
// find element by name
$he = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByName("rad");
 
// if collection is invalid then return -1
if (($heCol->IsVoid) || ($heCol->ErrorDetected)) return -1;
 
// insert element to collection
$heCol->Insert($he, 0);

Requirements

Target Platforms: Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows Seven

See Also

© 2013 All Rights Reserved.