I am very new to WinTree.
My project has a UserControl tree I have been able to code the creation of the tree with static parent and child nodes.
Basicly useing:
Dim treeBatchNav As UltraTree Dim node As UltraTreeNode Dim childNode As UltraTreeNode treeBatchNav = New UltraTree With treeBatchNav
node = .Nodes.Add("Claim Node 1 TEST") 'Claim Number ' Add some child nodes for claim pages. childNode = node.Nodes.Add("Page node 1TEST") 'Claim Page childNode = node.Nodes.Add("Page node 2TEST") 'Claim Page childNode = node.Nodes.Add("Page node 3TEST") 'Claim Page childNode = node.Nodes.Add("Page node 4TEST") 'Claim Page ' Add root nodes for claim numbers node = .Nodes.Add("Claim Node 2TEST") 'Claim Number End With group.Container.Controls.Add(treeBatchNav)
Now I want to create these based off of a datasource well two if I can.
I have a tableadapter that lists claim numbers. For each claim number that is returned I want that to be a parent node.
Under each Parent node. I would like to reach out to a second tableadapter that has the pages listed.I would create a child Node for each page. (I can hard code the pages if I have too.)
So this is what I envision but can not find help on hardcoding datasources in VB.
With treeBatchNav With claimdatasource whilenot eof node = .Nodes.Add(claimnumbercolumnvalue) 'Claim Number With pagedatasource whilenot eof childNode = node.Nodes.Add(pagecolumnvalue) 'Claim Page move.next End With move.next End WithEnd With
I am guessing completely off base on how to even acomplish this. Please point me to the appropriate help documents or help me out here.
Loop through the first dataset having claim info and create parent node. Before adding the node to the tree loop through dataset having page information and add as many child nodes as the rows in the dataset. Then add the child nodes to the parent node and finally add the parent node to the tree.
Here is a sample code.
Dim wfNode As New UltraTreeNode
wfNode.Key = mvarDataRow("claimnumber")
wfNode.Text = mvarDataRow("claimnumber")
wfNode.Tag = mvarDataRow("claimnumber")
If Not pagedatasource Is Nothing AndAlso pagedatasource.Tables.Count > 0 AndAlso pagedatasource .Tables(0).Rows.Count > 0 Then
childNode = New Infragistics.Win.UltraWinTree.UltraTreeNode
childNode.Text = row.Item("pagecolumnname").Trim.ToString()
wfNode.Nodes.Add(childNode)
Next
End If
Hope it helps.
Best
S.
Thank you. This is great.
I am having a problem now where I can not get my two tables loaded into my data set.
My dataset is CA_ProdDataSet
Here is my code to load that tables.
Me.Tbl_Prod_UMCN_FlagsTableAdapter.FillByBatchID(Me.CA_ProdDataSet.tbl_Prod_UMCN_Flags, gblUserName, BatchID) 'parent node claim numbers Me.Tbl_Prod_UMCN_PagesTableAdapter.FillByAll(Me.CA_ProdDataSet.tbl_Prod_UMCN_Pages) 'child node claim pages
Here is the code I have created of your reply.
For Each mvarDataRow As DataRow In Me.CA_ProdDataSet.Tables(2).Rows Dim wfNode As New UltraTreeNode treeBatchNav.Nodes.Add(wfNode) wfNode.Key = mvarDataRow("ClaimID") wfNode.Text = mvarDataRow("ClaimID") wfNode.Tag = mvarDataRow("ClaimID") If Not Me.CA_ProdDataSet.Tables(3) Is Nothing AndAlso Me.CA_ProdDataSet.Tables(3).Rows.Count > 0 Then For Each row As DataRow In Me.CA_ProdDataSet.Tables(3).Rows childNode = New Infragistics.Win.UltraWinTree.UltraTreeNode childNode.Tag = row.Item("ClaimPages").ToString() childNode.Text = row.Item("ClaimPages").ToString() wfNode.Nodes.Add(childNode) Next End If Next
Now here is the problem if I use Me.CA_ProdDataSet.Tables(0) or (1) it is not the correct table. So its stops here: wfNode.Key = mvarDataRow("ClaimID") ... and says that ClaimID is not a column in the table XXXXX
It is two other tables I loaded when the forum loads. When I used Me.CA_ProdDataSet.Tables(2) it jumps past the node creation as if it returns no rows but does not say the data collection was empty.