• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 152
  • Last Modified:

need a code

I have made a treeview box. what would be the code to select a node from that treeview so that it will print some text in a text box or rich text box?  also if i select another node it should print a second text below the first text (in next line)in the text box.
0
mailsuhail
Asked:
mailsuhail
1 Solution
 
watyCommented:
Use the following text as a start

Private Sub treeDatabase_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

   If treeDatabase.SelectedItem Is Nothing Then Exit Sub

   If (Button = vbRightButton) Then
      treeDatabase.SelectedItem = treeDatabase.HitTest(X, Y)
           
      If treeDatabase.SelectedItem Is Nothing Then Exit Sub
           
      If treeDatabase.SelectedItem.Parent Is Nothing Then
         ' *** Popup for categories
     
      Else
         ' *** Popup for items
     
      End If
   End If

End Sub

Public Sub treeDatabase_NodeClick(ByVal Node As ComctlLib.Node)

   If treeDatabase.SelectedItem Is Nothing Then Exit Sub
   
   tbTexbox1.Text = tbTexbox1.Text & "Your Text"

End Sub
0
 
mailsuhailAuthor Commented:
answer may be correct but too complicated for me to understand.
0
 
jbilCommented:
Private Sub TreeView1_Click()


Select Case TreeView1.SelectedItem
    Case "Root" 'or whatever node text is
    Text2.SelText = "This is the Root" & vbCrLf 'or your choice
    Case "Child" '
    Text2.SelText = "This is the Child" & vbCrLf 'or your choice
End Select

End Sub
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now