1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
| Private Function GRD_AddLine(ByRef rrecRecord As ADODB.Recordset, ByVal vintOutlineLevel As Short) As Boolean
On Error GoTo Error_GRD_AddLine
Dim blnReturn As Boolean
Dim intRow As Short
Dim recRecord As New ADODB.Recordset
blnReturn = True
'ajoute le texte a mettre dans le tree
grdCompte.AddItem(NullString)
intRow = grdCompte.Rows - 1
If rrecRecord.Fields("Header").Value = 1 Then
'Indique que cette ligne est un header
grdCompte.set_IsSubtotal(intRow, True)
'Indique l'indentation de la ligne
grdCompte.set_RowOutlineLevel(intRow, vintOutlineLevel)
grdCompte.Cell(VSFlex7.CellPropertySettings.flexcpFontBold, intRow, 0, , grdCompte.Cols - 1) = True
Else
'do nothing
End If
'Feed la ligne
grdCompte.TextMatrix(intRow, mintGRDCompte_col) = (rrecRecord.Fields("Description").Value
If rrecRecord.Fields("Entete").Value = 1 Then
Call CloneRecordSet(rrecRecord, recRecord)
'Regarde si le compte courant est parent d'autres comptes. On doit donc ajouter tous ces comptes
recRecord.Filter = NullString
'Mon problème est ici ma valeur reste la même pourtant en vb6 elle changeait automatiquement
recRecord.Filter = "ID_Parent=" & rrecRecord.Fields("ID").Value
Do While Not recRecord.EOF
Call GRD_AddLine(recRecord, intOutlineLevel + 1)
recRecord.MoveNext()
Loop
Else
'C'est fini !
End If
Exit_GRD_AddLine:
recRecord = Nothing
GRD_AddLine = blnReturn
Exit Function
Error_GRD_AddLine:
blnReturn = False
Resume Exit_GRD_AddLine
End Function |
Partager