ToDouble2DArray(Var NonDoublesExist: Boolean): Array;
ToDouble2DArray(var NonDoublesExist: boolean): System.Array;
NonDoublesExist. Indicates whether array has non-real values.
The ToDouble2DArray method transforms range into two dimensional array of real numbers.
After executing the method, the NonDoublesExist parameter has the following value:
True if the array has no non-real values.
False if transformed range has non-real values. Instead of the elements with non-real value there is a NaN in the array.
If the ITabErrorCheckingOptions.EnableChecking property is set to True, on calling the ToDouble2DArray method all options from ITabSheet.ErrorCheckingOptions are taken into account.
To execute the example a form that contains the Button component with the Button1 identifier, the TabSheetBox component with the TabSheetBox1 identifier and the UiTabSheet component with the UiTabSheet1 identifier are required. Set the UiTabSheet1 component as a data source for the TabSheetBox1 component.
The example is a handler of the OnClick event for the Button1 component.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
TSheet: ITabSheet;
TRange: ITabRange;
Arr: Array Of Double;
NonDoubleExist: Boolean;
Begin
TSheet := UiTabSheet1.TabSheet;
TRange := TSheet.View.Selection.Range;
Arr := TRange.ToDouble2DArray(NonDoubleExist);
If NonDoubleExist Then
Debug.WriteLine("The array has non-real values");
Else
Debug.WriteLine("The array has only real values");
End If;
End Sub Button1OnClick;
Clicking the button creates the Arr real array where values of the selected table range are placed. The console window displays the message that the Arr array has non-real values..
The requirements and result of the Fore.NET Example execution match with those in the Fore Example. Use Fore.NET analogs instead of Fore components.
Imports Prognoz.Platform.Interop.Tab;
…
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
TSheet: ITabSheet;
TRange: ITabRange;
Arr: Array[,] Of Double;
NonDoubleExist: Boolean;
Begin
TSheet := UiTabSheetNet1.TabSheetUi.TabSheet;
TRange := TSheet.View.Selection.Range;
Arr := TRange.ToDouble2DArray(Var NonDoubleExist) As Array[,] Of Double;
If NonDoubleExist Then
System.Diagnostics.Debug.WriteLine("The array has non-real values");
Else
System.Diagnostics.Debug.WriteLine("The array has only real values");
End If;
End Sub;
See also: