Results 1 to 3 of 3

Thread: Add Child Nodes to Treeview dynamically

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2009
    Posts
    257

    Add Child Nodes to Treeview dynamically

    Hello,

    I have the following code which checks for the value of the 'cc_supplier_status' column for each of the rows in my table. If the state is 0, I need a child node to be added to a node named 'Inactive Suppliers' in my tree view (tvw_Supplier) with it's text being the value of the 'cc_supplier_name' value for the same row.

    If the state is 1, a child node is to be added to a node named 'Active Suppliers'.

    If the state is 2, a child node is to be added to a node named 'Pending Suppliers'.

    The code I have now just filters out the status value for each row, and performs a select case on it. I need to know how I'd add a new child node to the parent nodes mentioned above.


    Code:
            Dim totalRows As Integer = Me.CCSuppliersDataSet.tblSuppliers.Rows().Count()
    
            Dim counter As Integer
            For Each row As CCSuppliersDataSet.tblSuppliersRow In Me.CCSuppliersDataSet.tblSuppliers.Rows()
    
                Dim name As String = row.cc_supplier_name.ToString()
                Dim status As Integer = row.cc_supplier_status()
                Select Case status
                    Case 0
                        ' Add a node who's text is the value of 'name' to the 
                        ' Inactive Suppliers node
    
                    Case 1
                        ' Add a node who's text is the value of 'name' to the 
                        ' Active Suppliers node
    
                    Case 2
                        ' Add a node who's text is the value of 'name' to the 
                        ' Pending Suppliers node
    
                End Select
    
                counter = counter + 1
    
                Dim percentage As Integer = CInt((counter / totalRows) * 100)
                Me.bgwk_Supplier_Nodes.ReportProgress(percentage)
    
            Next

    Thanks.
    Last edited by r000t; Aug 24th, 2011 at 09:02 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width