| | Site Map |
Support
Bits
and Pieces
| Loading selected rows in itGrid into a .Net DataTable |
This code can be used to populate a .Net DataGrid with rows that have been selected in itGrid. To use this code, ensure that you have used:
itGrid.SelectionMode = itGrid6.SelectionModeConstants.itSelectListBox
Here's some code that calls the DataTable populating procedure...
|
If
itGrid1.SelectedCount > 0
Then
Dim
dt
As
System.Data.DataTable
End If |
And here's the code that populates the DataTable...
|
Private Function DataTableFromSelectedRows(ByVal grid As AxitGrid6.AxitGrid) As System.Data.DataTable Dim
dt
As New
System.Data.DataTable("test")
With grid col1 = .FixedCols
' Load the DataTable columns
Case
itGrid6.DataTypeConstants.itString
Case
itGrid6.DataTypeConstants.itLong
Case
itGrid6.DataTypeConstants.itInteger
Case
itGrid6.DataTypeConstants.itBoolean
' You can add more data types here, or use this as a general purpose
End Select
start = Environment.TickCount ' Load the DataTable rows
var = .get_ValueMatrix(row,
col1, row, col2)
End If
finish = Environment.TickCount End With DataTableFromSelectedRows = dt ' WOW!, that was quick :)
End Function |