Link to home
Start Free TrialLog in
Avatar of YomTovSuccos
YomTovSuccos

asked on

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

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
Avatar of gafoorgk
gafoorgk

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.
well, kaliyug ka arjun, aapka theer acha hei.  that's a good one but not stable as i used it before.
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
Avatar of YomTovSuccos

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of gafoorgk
gafoorgk

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Iil use VsFlex Grid Thanks A Milion