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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable click on root node of treeview

Status
Not open for further replies.

soj

Programmer
Jul 29, 2002
1
CA
I want to disable the click and drag & drop on the root node, but allow drag and drop on the rest. Right now drag and drop are working on all the nodes.

Here is my code:

Private Sub Form_Load()

Dim rsBO As New ADODB.Recordset
Dim objBO As New BOL.clsBOLInventory

Set rsBO = objBO.GetBackOrderItems

Dim oNode As Node

Set oNode = tvwInventory.Nodes.Add(, , "R", "Inventory")

With rsBO
Do Until .EOF
Set oNode = tvwInventory.Nodes.Add(1, tvwChild)
oNode.Text = !InvName
oNode.Key = !InvName
.MoveNext
Loop
End With

oNode.EnsureVisible
End Sub
 
1) on the Click event of the treeview - if the selected node is the root then remove it from the selected items collection.

2) on drag and drop - check to see if the target node is the root. If so disable drop and show "no-drop" icon else allow drop
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top