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

dragdrop

Status
Not open for further replies.

fmardani

Programmer
Joined
Jul 24, 2003
Messages
152
Hi,
Before running this code in vb.net windows (Which I have included two treeviews), it gives an error of type expected and the TreeView is underlined.???
Thanks

Public Sub TreeView_DragDrop(ByVal sender As Object, _
ByVal e As DragEventArgs) _
Handles TreeView2.DragDrop, TreeView1.DragDrop
Dim NewNode As TreeNode
If e.Data.GetDataPresent("System.Windows.Forms.TreeNode", False) Then
Dim pt As Point
Dim DestinationNode As TreeNode
pt = CType(sender, TreeView).PointToClient(New Point(e.X, e.Y))
DestinationNode = CType(sender, TreeView).GetNodeAt(pt)
NewNode = CType(e.Data.GetData("System.Windows.Forms.TreeNode"), _
TreeNode)
If Not DestinationNode.TreeView Is NewNode.TreeView Then
DestinationNode.Nodes.Add(NewNode.Clone)
DestinationNode.Expand()
'Remove original node
NewNode.Remove()
End If
End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top