Question TreeView not scrolling when node is expanded

hp07

New member
Joined
Apr 23, 2009
Messages
1
Programming Experience
1-3
Hello,

I have wrote simple TreeView control that basically gets data for display as control items in tree as data table from documentum. Everything is working good but the problem happens when tree node expansion is not containable in pane. When node is expanded, it instead of showing scrollbar on right, just resets everything and again tree is shoed as collapsed.

Here is the code:

Code:
Public Class DCTMBrowserTreeControl

    Dim DotNetDocSamples1 As Emc.Documentum.FS.Doc.Samples.Client.QueryServiceDemo
    Dim DotNetDocSamples2 As Emc.Documentum.FS.Doc.Samples.Client.QueryServiceDemo

    Private Sub DCTMTreeCtl_Layout(ByVal sender As Object, ByVal e As System.Windows.Forms.LayoutEventArgs) Handles DCTMTreeCtl.Layout
        Me.DCTMTreeCtl.Nodes.Clear()
        Me.DCTMTreeCtl.Nodes.Add(New System.Windows.Forms.TreeNode("XL Legal"))

        Dim subTree As New System.Windows.Forms.TreeNode
        subTree = Me.DCTMTreeCtl.Nodes(0)
        PopulateTreeView(0, subTree)

    End Sub

    Private Sub PopulateTreeView(ByVal inParentID As Integer, ByRef inTreeNode As System.Windows.Forms.TreeNode)

        Dim ds As New DataSet
        Dim dtRootTreeNodes1 As DataTable

        Me.DotNetDocSamples1 = New Emc.Documentum.FS.Doc.Samples.Client.QueryServiceDemo("repository", "", "user", "password", "dfs_server_url")
        dtRootTreeNodes1 = Me.DotNetDocSamples1.CachedPassthroughQueryForLegal1
        ds.Tables.Add(dtRootTreeNodes1)

        Dim parentrow As DataRow
        For Each parentrow In dtRootTreeNodes1.Rows
            Dim parentnode As System.Windows.Forms.TreeNode
            Dim strLabel As String = parentrow.Item(1)
            parentnode = New System.Windows.Forms.TreeNode(strLabel)
            inTreeNode.Nodes.Add(parentnode)

            parentnode.Tag = parentrow.Item(0)

            PopulateTreeViewR(parentrow.Item(0), parentnode)
        Next parentrow

    End Sub

    Private Sub PopulateTreeViewR(ByVal inParentID As String, ByRef inTreeNode2 As System.Windows.Forms.TreeNode)

        Dim ds2 As New DataSet
        Dim dtRootTreeNodes2 As DataTable


        Me.DotNetDocSamples2 = New Emc.Documentum.FS.Doc.Samples.Client.QueryServiceDemo("repository", "", "user", "password", "dfs_server_url")
        dtRootTreeNodes2 = Me.DotNetDocSamples2.CachedPassthroughQueryForLegal2(inParentID)
        ds2.Tables.Add(dtRootTreeNodes2)

        Dim parentrow2 As DataRow
        For Each parentrow2 In dtRootTreeNodes2.Rows
            Dim parentnode2 As System.Windows.Forms.TreeNode
            Dim strLabel2 As String = parentrow2.Item(1)
            parentnode2 = New System.Windows.Forms.TreeNode(strLabel2)
            inTreeNode2.Nodes.Add(parentnode2)

            parentnode2.Tag = parentrow2.Item(0)

            PopulateTreeViewR(parentrow2.Item(0), parentnode2)
        Next parentrow2


    End Sub

End Class
 
Top Bottom