ToIntegerArray([SkipNonIntegers: Boolean = false]): Array;
ToIntegerArray(SkipNonIntegers: boolean): System.Array;
SkipNonIntegers. Indicates whether non-integer values must be skipped.
The ToIntegerArray method converts a range into an integer array.
The SkipNonIntegers parameter determines the rule of skipping non-integer values of the range. Available values:
True. Non-integer value will be skipped.
False. Default value. The item with non-integer value is replaced to 0 in the array.
If the ITabErrorCheckingOptions.EnableChecking property is set to True, on calling the ToIntegerArray method all options of 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 Integer;
Begin
TSheet := UiTabSheet1.TabSheet;
TRange := TSheet.View.Selection.Range;
Arr := TRange.ToIntegerArray(True);
// Get array length
Debug.WriteLine("Array length: " + Arr.Length.ToString);
End Sub Button1OnClick;
Clicking the button creates the Arr integer array where values from the selected table range are placed. Non-real values will be ignored. The console displays message about the Arr array length.
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;
Begin
TSheet := UiTabSheetNet1.TabSheetUi.TabSheet;
TRange := TSheet.View.Selection.Range;
Arr := TRange.ToIntegerArray(True);
// Get array length
System.Diagnostics.Debug.WriteLine("Array length: " + Arr.Length.ToString());
End Sub;
See also: