Solved

need a code

Posted on 1998-11-23
3
139 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
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:
jbil earned 0 total points
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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 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…

744 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

17 Experts available now in Live!

Get 1:1 Help Now