ParseValue(Value: String);
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.
To execute the example a form, a button on this form named the Button1, the TabSheetBox component and the UiTabSheet component named UiTabSheet1 are required. 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.
To execute the example a form, a button on this form named Button1, the TabSheetBoxNet component and the UiTabSheetNet component named UiTabSheetNet1 are required. UiTabSheetNet1 is selected as the data source for the TabSheetBoxNet component.
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
TSheet: ITabSheet;
r, r1, r2, r3: ITabRange;
Begin
TSheet := UiTabSheetNet1.TabSheetUi.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;
On clicking the button 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: