Results 1 to 4 of 4

Thread: [RESOLVED] Treeview Requirement in vb6

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2009
    Location
    Bangalore India
    Posts
    201

    Resolved [RESOLVED] Treeview Requirement in vb6

    Hi!
    Happy New Year 2010 to all the mebers of vbforums.
    i have 1 requirement in vb6.
    please find the snapshot as enclosed.
    I have attacthed the snapshot of the outlook mail.
    in that if you see in the left hand side pane you will have a treeview of inbox.
    as you as you receive any new mail then it will count the no of mails received in the main parent node.

    I have a similar situation in my project.
    i have a form in which i have put a treeview & from database im populating some data.
    now i want to have a similar functionality like counting the no of nodes & displaying that in the treeview parent node i.e it should count the no of childs & display that in the parent node.

    how to do this in treeview in vb6.
    pls help me in this regard.
    with regards!
    Sethuraman R
    Attached Images Attached Images  

  2. #2
    Frenzied Member
    Join Date
    Mar 2009
    Posts
    1,182

    Re: Treeview Requirement in vb6

    This might be a dumb question, but if you are populating the children, can you not count the children prior to adding the parent node (since you have this information) and add the count to the string you use for display, or go back and edit the string???



    Good Luck
    Option Explicit should not be an Option!

  3. #3
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Treeview Requirement in vb6

    Is this what you want?

    Code:
    Option Explicit
    
    Private Const TVM_GETCOUNT = &H1105&
    Private Declare Function SendMessage Lib "user32" Alias _
    "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal _
    wParam As Long, lParam As Any) As Long
    
    Private Sub Form_Load()
        Dim lngCnt As Long, nodX As Node
        Set nodX = TreeView1.Nodes.Add(, , "R", "Root")
        For lngCnt = 1 To 5
            '~~> Adding 5 Sample Nodes
            Set nodX = TreeView1.Nodes.Add("R", tvwChild, "C" & lngCnt, _
                       "Child " & lngCnt)
        Next
    End Sub
    
    Private Sub Command1_Click()
        Dim NodesCount As Long
        '~~> Get Total Node count including treeview parent node
        NodesCount = SendMessage(TreeView1.hwnd, TVM_GETCOUNT, 0, ByVal 0)
        
        '~~> Update Text of the parent code
        TreeView1.Nodes.Item(1).Text = TreeView1.Nodes.Item(1).Text & " (" & (NodesCount - 1) & ")"
    End Sub
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Feb 2009
    Location
    Bangalore India
    Posts
    201

    Arrow Re: Treeview Requirement in vb6

    Hi!
    milions of Thanks to you it worked....

    with regards!
    Sethuraman R

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