fmardani
Programmer
- Jul 24, 2003
- 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
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