1 Attachment(s)
[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
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
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
Re: Treeview Requirement in vb6
Hi!
milions of Thanks to you it worked....
with regards!
Sethuraman R