>I have a TextBox control in Form.
>Format property of TextBox control is set to D (TextBox.Format = D) which is Date.
Which is good, because D ensures that the current Set Date format is used for date values...
>When I type in some date into TextBox control and I check VARTYPE of that value it returns "C" (VARTYPE(TextBox.Value)="C").
>I expected to return "D" instead of "C".
>
>Why is that happening?
...but the value is not a date, it's a string. You should either bind the textbox to a date field, or, if it's unbound, initialize its .value (in PEM sheet is also ok) to an empty date - {} is the shortest way I know of.