ParseValue(Value: String);
Value. The value to be transformed.
The ParseValue method transforms the value from the string passed by the value parameter in accordance with the value type and sets this value for the range.
When this method is invoked the system automatically identifies the type of the value passed in the Value character string. The cells of the range are immediately formatted in accordance with the value type. The cell editor includes a calendar for the values of the date type.
Executing the example requires a form with the Button1 button located on it, the TabSheetBox component and the UiTabSheet component named UiTabSheet1. UiTabSheet1 is selected as the data source for the TabSheetBox component.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
TSheet: ITabSheet;
r, r1, r2, r3: ITabRange;
Begin
TSheet := UiTabSheet1.TabSheet;
r := TSheet.Cell(0, 0);
r1 := TSheet.Cell(0, 1);
r2 := TSheet.Cell(0, 2);
r3 := TSheet.Cell(0, 3);
//Set values using ParseValue method
r.ParseValue("100");
Debug.WriteLine(r.Value.VarType);
r1.ParseValue("01.01.2001");
Debug.WriteLine(r1.Value.VarType);
//Set values using Value property
r2.Value := "100";
Debug.WriteLine(r2.Value.VarType);
r3.Value := "01.01.2001";
Debug.WriteLine(r3.Value.VarType);
End Sub Button1OnClick;
When this example is executed the values of the cells in A0:D0 range are set using various methods. Types of the data that have some values in the cells are to be displayed in the console of the development environment.
See also: