GrapeCity.Win.MultiRow Namespace > GcMultiRow Class > Sort Method : Sort(Int32) Method |
Dim instance As GcMultiRow Dim cellIndex As Integer instance.Sort(cellIndex)
Exception | Description |
---|---|
System.ArgumentOutOfRangeException | The cellIndex is less than 0 or greater than the number of Cells in the Row minus 1. |
System.InvalidOperationException | This method cannot be accessed when the Template is a null reference (Nothing in Visual Basic). -or- VirtualMode is true and DataSource is a null reference (Nothing in Visual Basic). |
This method sorts the contents of the GcMultiRow control by comparing values in the specified cells with the same cell index. By default, the sort operation uses the System.Collections.Comparer.Compare(System.Object,System.Object) method to compare pairs of cells by using the Value property.
You can write an event handler for the CellMouseClick event for ColumnHeaderCell and call this method. In this case, you typically set the SortMode property to SortMode.Programmatic to disable automatic sorting and to leave room for a sorting glyph. When sorting by cells set to programmatic sort mode, you must display the sorting glyph yourself by setting the SortGlyphDirection property.
If the AllowUserToAddRows property value is true, the last row is always the last row. In this case, the sorting operator does not effect the last row (uncommitted new row).
void SortByCode() { // Sort first cell of all rows. this.gcMultiRow1.Sort(0); }
Private Sub SortByCode() ' Sort first cell of all rows. Me.gcMultiRow1.Sort(0) End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2