Answer.Value Property

[Read/Write] This is a dynamic property that holds the value of the answer at the current repeat index.

Syntax

dynamic Value [ set, get ]

The data type can be interpreted like this:

Type Data Type Description
HD_TEXTTYPE string Multi-line Text answers will contain carriage return (cr) and line feed (lf) characters to delimit lines.
HD_NUMBERTYPE number Number value.
HD_DATETYPE dateTime Date value.
HD_TRUEFALSETYPE boolean True/False (Boolean) value.
HD_MULTCHOICETYPE string
array | string
Multiple Choice values can be interpreted several ways, depending on whether the Multiple Choice variable is specified as single-select or multiple-select:
  • When retrieving the single value of a Multiple Choice variable, the value will be returned as a string.
  • When retrieving multiple values, the value will be returned as an array of strings.

Example (Visual C#)

A multi-line value can be set by adding the carriage return and line feed characters as follows:
class ExampleCode
{
    static void Main()
    {
        HotDocs.AnswerCollection asc = new HotDocs.AnswerCollection();
        HotDocs.Answer ans = new HotDocs.Answer();
         
        asc.Create(@"C:\temp\AnswersFile.anx");
        HotDocs.HDVARTYPE vType = HotDocs.HDVARTYPE.HD_MULTCHOICETYPE;
        ans = asc.Item("multiplechoice", ref vType);
         
        MessageBox.Show(ans.Value = "Line 1" + "\r\n" + "Line 2" + "\r\n" + "Line 3");
             
        asc.Close();
    }
}
If you want to retrieve multiple values from a multiple-select Multiple Choice variable, 
you can retrieve an array of strings like this:
         
        ....
        for (int i = 0; i < ans.Value.Length; i++)
        {
            MessageBox.Show(ans.Value[i]);
        }
To set a single value of a Multiple Choice variable, you can use the Value property and a string (VT_BSTR), 
or you can use the AddMultipleChoiceValue method:
         
        ....
        ans.Value = "Single Value"; 
         
        //or
        ans.AddMultipleChoiceValue("Single Value");
To set multiple values of a multiple-select Multiple Choice variable, you can set Value using a 
single string that contains values delimited by a vertical bar ( | ) character, an array of strings, 
or you can use a series of calls to the AddMultipleChoiceValue method:
         
        ....
        ans.Value = "FirstValue|SecondValue|ThirdValue"; 
         
        //or
        string[] values = new string[3];
         
        values[0] = "FirstValue";        
        values[1] = "SecondValue";
        values[2] = "ThridValue";
        ans.Value = values;
         
        //or
        ans.AddMultipleChoiceValue("FirstValue");
        ans.AddMultipleChoiceValue("SecondValue");
        ans.AddMultipleChoiceValue("ThirdValue");