?
Solved

need a code

Posted on 1998-11-23
3
Medium Priority
?
150 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

771 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