Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TreeView ?

Status
Not open for further replies.

access97to2000

Programmer
Aug 12, 2002
45
0
0
US
Hi I have 2 treeviews A and B and a button.
If a user click any of the treeviews and click the button I want to get the name of the treeview which is clicked (is it a or b)
how can i do it ?
and can anyone please answer my question change of filed posted today.
Thanks
Rako
 
I've never messed with any tree view, but here's what comes to mind.

I'm assuming you mean you want to know which of these was clicked last?

Just set a flag each time either one of them is clicked. If A is clicked, set your flag to one thing. If B is clicked, set your flag to something else. Then when the button is clicked, have it check the value of the flag and act accordingly. --
Jonathan
 
Dim which As String

Private Sub Command1_Click()
MsgBox (which + " was clicked on last.")
End Sub

Private Sub TreeView1_Click()
which = "TreeView1"
End Sub

Private Sub TreeView2_Click()
which = "TreeView2"
End Sub
 
Or, if you want to keep it generic:


Private Sub TreeView1_Click()
which = ActiveControl.Name
End Sub

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top