Solved

need a code

Posted on 1998-11-23
3
148 Views
Last Modified: 2010-05-03
i have made a treeview box. how do i  select a node from that treeview so that it will print some text in the text box.and also if i select another node it should print another text in the same text box below the first one( in next line)
0
Comment
Question by:mailsuhail
3 Comments
 
LVL 14

Expert Comment

by:waty
ID: 1446303
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: 1446304
answer may be correct but too complicated for me to understand.
0
 
LVL 3

Accepted Solution

by:
hakyemez earned 0 total points
ID: 1446305
Use NodeClick Event...
Sample Code
===========
Private Sub TreeView1_NodeClick(ByVal Node As ComctlLib.Node)
    Text1.Text = Node.Text
End Sub

0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

749 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