Treeview with context menus



Trying to make a form with a TreeView control and context menus. So rather than having buttons for the typical Add, Edit and Remove commands, I'd like to do everything in context menus. Problem #1 is I can't find context menu controls (or any menus!) among Additional Controls in VBA. Problem #2 is that I can't find out how to catch a right mouse click in the TreeView.

Shall I resort to using the TreeView for selecting nodes only and use buttons for the Add, Edit and Remove commands?




Patrick Molloy

you can use the mousedown event to check which button was pressed ...

Private Sub TreeView1_MouseDown(ByVal Button As Integer, ByVal Shift As
Integer, ByVal x As stdole.OLE_XPOS_PIXELS, ByVal y As

MsgBox "button " & Button

End Sub

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question