Solved

need a code

Posted on 1998-11-23
3
143 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
Comment Utility
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
Comment Utility
answer may be correct but too complicated for me to understand.
0
 
LVL 3

Accepted Solution

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

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

763 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now