Solved

How can I create 3 columns in a TreeView in VB6?

Posted on 2006-06-28
7
826 Views
Last Modified: 2012-05-05
I would like to create 3 columns in a TreeView, where all the rows are Left justified one below the other, and the following is the sample code I used:

Set nodx = TreeView1.Nodes.Add(nodr, tvwChild, , "Rs.Name" & vbTab & "Rs.date" & vbTab & "Rs.Amount")

The vbTab is not good, because it returns a character that is from a different language. To put in spaces will not either be good, because the rows will not be properly aligned.

Please advise me how to work around this.
Thank you.
Yom Tov Succos
0
Comment
Question by:YomTovSuccos
  • 3
  • 2
  • 2
7 Comments
 
LVL 3

Expert Comment

by:gafoorgk
Comment Utility
Can u please explain a good reason why u want to use TreeView for this instead of using ListView or ms flex grid if u want hierarchical view of items ?

u can create as much columns as u want in ListView. TreeView, by it's nature, doesn't support columns. do the following for list view

    Dim lvwli As ListItem
    With ListView1
        .View = lvwReport
        With .ColumnHeaders
            .Add , "colName", "Name"
            .Add , "colDate", "Date"
            .Add , "colAmt", "Amount"
        End With
        Set lvwli = .ListItems.Add(, , "My Name")
        lvwli.SubItems(1) = "A Date"
        lvwli.SubItems(2) = "An Amount"
    End With

if u want hierarchical view, create a custom disconnected recordset with the hierarchy u want and bind it with a flex grid. it is much more powerful. if u want help on creating hierarchical disconnected recordset, lemme know.
0
 
LVL 8

Expert Comment

by:kaliyugkaarjun
Comment Utility
0
 
LVL 3

Expert Comment

by:gafoorgk
Comment Utility
well, kaliyug ka arjun, aapka theer acha hei.  that's a good one but not stable as i used it before.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 8

Expert Comment

by:kaliyugkaarjun
Comment Utility
Well..if u want then u can try this freeware

ActiveX tree control 3.12.65 from this link..

http://www.programmersheaven.com/zone15/cat234/29074.htm
0
 

Author Comment

by:YomTovSuccos
Comment Utility
Can u please explain a good reason why u want to use TreeView for this

I Need to use
nodx.Expanded = True
or

nodx.Expanded = False
0
 
LVL 3

Accepted Solution

by:
gafoorgk earned 500 total points
Comment Utility
in that case it's better to use msflex grid with disconnected hierarchical recordset as it'll give powerful control over UI.
0
 

Author Comment

by:YomTovSuccos
Comment Utility
Iil use VsFlex Grid Thanks A Milion
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

771 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now