Solved

need a code

Posted on 1998-11-23
3
143 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
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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Validating VB6 Function 19 61
Determine Range to Select 5 49
clicking a shape in a frame array vb6 3 45
MsgBox 4 62
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…

831 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