G
Guest
Hi,
I have the following method, which sends an array of integers to another
method. The array is obtained as follows:
1. Select rows from a datatable where boolColumn has been checked in a
datagrid.
Dim dRows() As dataRow = myDataTable.Select("boolColumn = True", "",
DataViewRowState.ModifiedCurrent)
2. Initialize array and set capacity
Dim arrayMyInts(dRows.Length) As Integer
3. Populate array by looping through the array of datarows returned by
..Select method.
For n As Integer = 0 To dRows.Length - 1
arrayMyInts(n) = dRows(n).myDataTableIntColumn1
Next n
The datatable has a key that consists of two integer columns,
myDataTableIntColumn1 and myDataTableIntColumn2. Therefore, the potential
exists that the array I populate in step 3 (arrayMyInts) is going to have
some duplicated values in it, as it could be that two or more datarows that
are returned by my Select methods criteria will have identical
myDataTableColumn1 values.
My question: How do I get at only the UNIQUE myDataTableColumn1 values?
Can this be done by refining my Select method? Could I query the array to
return only unique values? Any suggestions would be great. Thanks.
John
I have the following method, which sends an array of integers to another
method. The array is obtained as follows:
1. Select rows from a datatable where boolColumn has been checked in a
datagrid.
Dim dRows() As dataRow = myDataTable.Select("boolColumn = True", "",
DataViewRowState.ModifiedCurrent)
2. Initialize array and set capacity
Dim arrayMyInts(dRows.Length) As Integer
3. Populate array by looping through the array of datarows returned by
..Select method.
For n As Integer = 0 To dRows.Length - 1
arrayMyInts(n) = dRows(n).myDataTableIntColumn1
Next n
The datatable has a key that consists of two integer columns,
myDataTableIntColumn1 and myDataTableIntColumn2. Therefore, the potential
exists that the array I populate in step 3 (arrayMyInts) is going to have
some duplicated values in it, as it could be that two or more datarows that
are returned by my Select methods criteria will have identical
myDataTableColumn1 values.
My question: How do I get at only the UNIQUE myDataTableColumn1 values?
Can this be done by refining my Select method? Could I query the array to
return only unique values? Any suggestions would be great. Thanks.
John