Solved

Treeview question - easy!

Posted on 2002-07-18
10
121 Views
Last Modified: 2010-05-02
Once choosing an item in treeview, it populates the child nodes but on a long list you see the bottom of the list.  I want to expand it, but stay at the top (where the parent is) not at the bottom of the children.  How do I do it?
0
Comment
Question by:jackjeckyl
  • 4
  • 3
10 Comments
 
LVL 4

Expert Comment

by:gencross
ID: 7162948
When I expand the TreeView it stays at the top where the parent is even if the list of child nodes is longer than the treeview.  What properties are you setting?

Perhaps do a test and create a new treeview, don't set any properties and populate it.  This should do what you want.  Also, what version of the treeview control are you using?
0
 

Author Comment

by:jackjeckyl
ID: 7164878
I haven't changed any properties other than LabelEdit and SingleSel.  I started with ADO 2.5, but switched to 2.6 and it doesn't make a difference.
0
 
LVL 4

Expert Comment

by:gencross
ID: 7164880
Please post the code you are using.
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

Author Comment

by:jackjeckyl
ID: 7165088
Private Sub LoadDates(ByVal table_node As Node)
Dim rs As ADODB.Recordset
Dim sSQL As String
Dim i As Integer
Dim record_text As String
Dim record_node As Node

'Do nothing if the table's records are already loaded.
If table_node.Children > 0 Then Exit Sub

lblStatus.Caption = "Populating Dates"

Set rs = New ADODB.Recordset

i = 0
Do Until vJobInfo(i).sJob = Left$(table_node, Len(vJobInfo(i).sJob))
    i = i + 1
Loop

sSQL = "Select distinct(processingdate) as date from batch where lockboxid in (" & vJobInfo(i).sCustIDs & _
    ") order by processingdate desc "

With rs
    .Open sSQL, connProduction, adOpenStatic, adLockReadOnly
    Do Until rs.EOF
        table_node.Image = 2

        ' Add the record node
        Set record_node = TreeView1.Nodes.Add(table_node, tvwChild, , !Date)
        record_node.Tag = "Date"
        'record_node.EnsureVisible
        record_node.Visible = True

        ' Get the next record
        rs.MoveNext
       
        If .EOF Then
            ProgressBar1.Value = ProgressBar1.Max
        Else
            ProgressBar1.Value = (.AbsolutePosition / .RecordCount) * ProgressBar1.Max
        End If
       
    Loop
End With
   
rs.Close
Set rs = Nothing
ProgressBar1.Value = 0
lblStatus.Caption = "Select Date"

End Sub
0
 

Author Comment

by:jackjeckyl
ID: 7165090
Private Sub LoadDates(ByVal table_node As Node)
Dim rs As ADODB.Recordset
Dim sSQL As String
Dim i As Integer
Dim record_text As String
Dim record_node As Node

'Do nothing if the table's records are already loaded.
If table_node.Children > 0 Then Exit Sub

lblStatus.Caption = "Populating Dates"

Set rs = New ADODB.Recordset

i = 0
Do Until vJobInfo(i).sJob = Left$(table_node, Len(vJobInfo(i).sJob))
    i = i + 1
Loop

sSQL = "Select distinct(processingdate) as date from batch where lockboxid in (" & vJobInfo(i).sCustIDs & _
    ") order by processingdate desc "

With rs
    .Open sSQL, connProduction, adOpenStatic, adLockReadOnly
    Do Until rs.EOF
        table_node.Image = 2

        ' Add the record node
        Set record_node = TreeView1.Nodes.Add(table_node, tvwChild, , !Date)
        record_node.Tag = "Date"
        'record_node.EnsureVisible
        record_node.Visible = True

        ' Get the next record
        rs.MoveNext
       
        If .EOF Then
            ProgressBar1.Value = ProgressBar1.Max
        Else
            ProgressBar1.Value = (.AbsolutePosition / .RecordCount) * ProgressBar1.Max
        End If
       
    Loop
End With
   
rs.Close
Set rs = Nothing
ProgressBar1.Value = 0
lblStatus.Caption = "Select Date"

End Sub
0
 
LVL 4

Expert Comment

by:gencross
ID: 7165120
Try commenting the record_node.Visible = True line if you haven't already.


0
 

Author Comment

by:jackjeckyl
ID: 7165487
Yeah, I have.  I tried to switch between ensurevisible to visible.  Still don't work.
0
 

Accepted Solution

by:
Jgould earned 0 total points
ID: 7369154
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
vb6 connector to SQL Server 2 37
Recommendation vb6 to vb.net or others 14 174
Advice in Xamarin 21 96
which modules are active in VB6 project? 6 40
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question