Create a TreeList Programmatically
Posted on 2008-10-15
I'm having a little trouble populating a DevExpress treelist (in vb.net 2005) that I created via code. I can add it through the form design manually and it works fine.
However when I add it through code, it has no columns and no rows. Likewise, the IsUnBoundMode shows True. However, you can see that I assign a datasource. This same datasource works fine when I add the treelist manually in form design. So what am I doing wrong or what am I missing?
Here is my code:
Dim treelist2 As TreeList = New TreeList
treelist2.Name = "TreeList2"
treelist2.Dock = DockStyle.Fill
treelist2.OptionsBehavior.PopulateServiceColumns = True
treelist2.ParentFieldName = "fldcParentId"
treelist2.KeyFieldName = "fldKeyId"
treelist2.DataSource = dttHierDtl
treelist2.SelectImageList = imgSmallIcon
treelist2.StateImageList = imgSmallIcon
treelist2.CustomizationFormBounds = TreeList1.CustomizationFormBounds
treelist2.ImageIndexFieldName = "fldIconOpn"
treelist2.Visible = True