I converted a program from vb6 to vb.net, I used a propertybag to clone my recordsets and after I would filter them to navigate threw my data
and then show the result in a gridview, but I have a problem in vb.net with my filter.
In vb6 the program would go through my data, but in .net it stays on the same data and it goes into an infinite loop
My problem is to arrange my filter so that it can navigate through my data and change by itself
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
'add the text to put in the tree
grdCompte.AddItem(NullString)
intRow = grdCompte.Rows - 1
If rrecRecord.Fields("Header").Value = 1 Then
'This line is a header
grdCompte.set_IsSubtotal(intRow, True)
'Indicate the indentation of the line
grdCompte.set_RowOutlineLevel(intRow, vintOutlineLevel)
grdCompte.Cell(VSFlex7.CellPropertySettings.flexcpFontBold, intRow, 0, , grdCompte.Cols - 1) = True
Else
'do nothing
End If
'Feed the line with values
grdCompte.TextMatrix(intRow, mintGRDCompte_col) = (rrecRecord.Fields("Description").Value
If rrecRecord.Fields("Header").Value = 1 Then
Call CloneRecordSet(rrecRecord, recRecord)
'Look if it's parent with other accounts. Then add those accounts.
recRecord.Filter = NullString
'My problem is here, my value stays the same while in vb6 it was automatically changing
recRecord.Filter = "ID_Parent=" & rrecRecord.Fields("ID").Value
Do While Not recRecord.EOF
Call GRD_AddLine(recRecord, intOutlineLevel + 1)
recRecord.MoveNext()
Loop
Else
'DONE !
End If
Exit_GRD_AddLine:
recRecord = Nothing
GRD_AddLine = blnReturn
Exit Function
Error_GRD_AddLine:
blnReturn = False
Resume Exit_GRD_AddLine
End Function
Public Function CloneRecordSet(ByRef robjToClone As ADODB.Recordset, ByRef robjCloned As Object) As Boolean
On Error GoTo Error_CloneRecordSet
Dim blnReturn As Boolean
Dim oStr As New ADODB.Stream()
robjToClone.Save(oStr)
Dim resRecordset As New ADODB.Recordset()
'open the stream object in a new recordset
resRecordset.Open(oStr, , , robjToClone.LockType)
'return the recordset cloned
robjCloned = resRecordset
resRecordset = Nothing
blnReturn = True
Exit_CloneRecordSet:
CloneRecordSet = blnReturn
Exit Function
Error_CloneRecordSet:
blnReturn = False
Resume Exit_CloneRecordSet
End Function