I have a TreeList
reading from a List(Of LedgerAccountEntry)()
.
Public Class LedgerAccountEntry
Public Property LedgerAccountSys() As Integer
Public ParentLedgerAccountSys As Integer
'
'
' ETC
End Class
In form load:
tlLedgerAccounts.ParentFieldName = "ParentLedgerAccountSys"
tlLedgerAccounts.KeyFieldName = "LedgerAccountSys"
tlLedgerAccounts.RootValue = -1
Later on:
While bla
entry.LedgerAccountSys = rstAccounts("LedgerAccountSys").Value
entry.ParentLedgerAccountSys = IIf(rstAccounts("ParentLedgerAccountSys").Value Is DBNull.Value, -1, rstAccounts("ParentLedgerAccountSys").Value)
lst.add(entry)
End While
tlLedgerAccounts.DataSource = lst
These are just the relevant parts. Please let me know if you need more info.
The result is flat tree with no child nodes, I checked that the IDs exists and are being returned correctly.