FileCollection.Insert Method

This method inserts a new file name (and path) to the FileCollection at a specific location.

Syntax

void Insert ( int index, object newVal)

Parameters Description
index The 0-based index representing the location to insert the new string.
newVal The string to be added to the collection.

Example Code (C#):

//This example adds two files to a file collection and then displays the number
//of files in the collection and a delimited string containing the file path and
//name of each file in the collection. Then it adds another file to the collection
//between the two existing files and displays the updated count and delimited string.
 
HotDocs_Online.FileCollection fc = new HotDocs_Online.FileCollection();
 
fc.Add("c:\\inetpub\\wwwroot\\files\\demoempl.docx");
fc.Add("c:\\inetpub\\wwwroot\\files\\clauses.docx");
 
Console.WriteLine(fc.Count.ToString());
Console.WriteLine(fc.AsString);
 
fc.Insert(1, "c:\\inetpub\\wwwroot\\files\\lifeappl.hft");
 
Console.WriteLine(fc.Count.ToString());
Console.WriteLine(fc.AsString);

Example Code (Visual Basic):

' This example adds two files to a file collection and then displays the number
' of files in the collection and a delimited string containing the file path and
' name of each file in the collection. Then it adds another file to the collection
' between the two existing files and displays the updated count and delimited string.
 
Dim fc
Set fc = Server.CreateObject("HotDocs_Online.FileCollection")
 
fc.Add "c:\inetpub\wwwroot\files\demoempl.docx"
fc.Add "c:\inetpub\wwwroot\files\clauses.docx"
 
Response.Write fc.Count & "<br>"
Response.Write fc.AsString & "<br>"
 
fc.Insert 1, "c:\inetpub\wwwroot\files\lifeappl.hft"
 
Response.Write fc.Count & "<br>"
Response.Write fc.AsString