AnswerCollection.Add Method

This method adds a new answer to the AnswerCollection . This answer must have already been initialized using the Create method.

Syntax

void Add ( HotDocs.Answer newanswer )

Parameters Description
newanswer The Answer object to be added to the collection.

Example

The following Visual C# example adds two answers to an answer file, then saves and closes it.

public class ExampleCode
{
    static void Main()
    {
        HotDocs.AnswerCollection ac = new HotDocs.AnswerCollection();
        HotDocs.Answer ans;
         
        ac.Create(@"C:\Documents\HotDocs\Answers\AnswerFile.anx"); 
         
        ans = new HotDocs.Answer();
        ans.Create("Agreement Date", HotDocs.HDVARTYPE.HD_DATETYPE);
        ans.Value = "01/01/2009";
        ac.Add(ans); 
         
        ans = new HotDocs.Answer();
        ans.Create("Company Representative", HotDocs.HDVARTYPE.HD_MULTCHOICETYPE);
        ans.Value = "Stephanie Walker";
        ac.Add(ans);
        ans = null;
         
        ac.Save(@"C:\Documents\HotDocs\Answers\AnswerFile.anx");
          
        ac.Close(); 
    }
}