ZennoLab Assemblies Documentation
Add Method (HtmlElementCollection)
Example 

Type: Zennolab.CommandCenter.HtmlElement

The html element to be added to the end of the HtmlElementCollection.

Adds a html element to the end of the HtmlElementCollection.
Syntax
public void Add( 
   HtmlElement element
)

Parameters

element

Type: Zennolab.CommandCenter.HtmlElement

The html element to be added to the end of the HtmlElementCollection.

Example
The following code example demonstrates uses of the Add method. At first we take all html elements from page lessons.zennolab.com with tags "input:checkbox" then all html elements with tags "input:radio" and store in a collection HtmlElementCollection.
public static int Execute(Instance instance, IZennoPosterProjectModel project)
{
    // clear cookie
    instance.ClearCookie();
    
    // go to lessons.zennolab.com
    Tab tab = instance.MainTab;
    if ((tab.IsVoid) || (tab.IsNull)) return -1;
    if (tab.IsBusy) tab.WaitDownloading();
    tab.Navigate("lessons.zennolab.com");
    if (tab.IsBusy) tab.WaitDownloading();
    
    // find elments by tag
    HtmlElementCollection heCol = tab.FindElementsByTags("input:checkbox");
    
    // find elements by tag
    HtmlElementCollection newHeCol = tab.FindElementsByTags("input:radio");
    
    // add all elements from second to first collection
    for (int i = 0; i < newHeCol.Count; i++) heCol.Add(newHeCol.Elements[i]);
    
    return 0;
}
public static function Execute($instance, $project)
{
    // clear cookie
    $instance->ClearCookie();
    
    // go to lessons.zennolab.com
    $tab = $instance->MainTab;
    if (($tab->IsVoid) || ($tab->IsNull)) return -1;
    if ($tab->IsBusy) $tab->WaitDownloading();
    $tab->Navigate("lessons.zennolab.com");
    if ($tab->IsBusy) $tab->WaitDownloading();
    
    // find elments by tag
    $heCol = $tab->FindElementsByTags("input:checkbox");
    
    // find elements by tag
    $newHeCol = $tab->FindElementsByTags("input:radio");
    
    // add all elements from second to first collection
    for ($i = 0; $i < $newHeCol->Count; $i++) $heCol->Add($newHeCol->Elements[$i]);
    
    return 0;
}
Requirements

Target Platforms: Desktop: Windows XP SP3 and older. Server: Windows Server 2003 and older.

See Also

Reference

HtmlElementCollection Class
HtmlElementCollection Members
AddRange Method
Insert Method
InsertRange Method
Count Property
Elements Property

Send Feedback