SortAdoDataGrid




'Windows API/Global Declarations for :DataGrid Sort

'**************************************

Dim WithEvents adoPrimaryRS As Recordset
Private Sub grdDataGrid_HeadClick(ByVal ColIndex As Integer)
Dim strColName As String
Static bSortAsc As Boolean
Static strPrevCol As String

strColName = grdDataGrid.Columns(ColIndex).DataField

'La pressione sulla colonna provoca un Not

'di ordinamento Ascendente/Discendente


If strColName = strPrevCol Then
If bSortAsc Then
adoPrimaryRS.Sort = strColName & " DESC"
bSortAsc = False
Else
adoPrimaryRS.Sort = strColName
bSortAsc = True
End If
Else
adoPrimaryRS.Sort = strColName
bSortAsc = True
End If
strPrevCol = strColName
End Sub

'---====[ pAssed by vbTips32 codeBook ]====---

La connessione all'oggetto deve essere stabilita
ed il Recordset aperto










( sortadodatagrid.html )- by Paolo Puglisi - Modifica del 17/12/2023