Solved

need a code

Posted on 1998-11-23
3
149 Views
Last Modified: 2010-05-03
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
Comment
Question by:mailsuhail
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 14

Expert Comment

by:waty
ID: 1446291
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
 

Author Comment

by:mailsuhail
ID: 1446292
answer may be correct but too complicated for me to understand.
0
 
LVL 3

Accepted Solution

by:
jbil earned 0 total points
ID: 1446293
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…

688 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