Hi Guru
First of i would like to thank you for quick reply. KB article was of quite help. The sample code was in C# but i manged to convert it into VB code and i could create a label on the form during drag drop operation. But its a round about solution which helped me to continue with my work ahead. below the code showing what i have done. please go through it and see if you can give me a better solution. But please i would be gratefull if something in VB.net... ;-)
i have placed a TreeView control With the name "DataSource" on the form ,having form name as "FORM1"....i have set the allowdrop property of the form to "TRUE"
these are the four events i have used to achieve my task
Dim labelText as String
Private Sub DataSource_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataSource.MouseDown
Try
If e.Button = MouseButtons.Left Then
Dim p As Point
p = DataSource.PointToClient(Control.MousePosition)
Dim node As TreeNodeAdv
node = DataSource.PointToNode(p)
DataSource.SelectedNode = node
DataSource.Refresh()
Labeltext = node.Text
End If
Catch ex As Exception
End Try
End Sub
Private Sub DataSource_ItemDrag(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemDragEventArgs) Handles DataSource.ItemDrag
Try
Dim treeViewAdv As TreeViewAdv = CType(sender, TreeViewAdv)
Dim nodes As TreeNodeAdv() = CType(e.Item, TreeNodeAdv())
Dim node As TreeNodeAdv = nodes(0)
treeViewAdv.DoDragDrop(node.Text, DragDropEffects.Move Or DragDropEffects.Copy)
Catch ex As Exception
End Try
End Sub
Private Sub Form1_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles MyBase.DragEnter
e.Effect = DragDropEffects.Copy
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
Try
Dim lbl As New Label
Dim LblPos As Point
LblPos.X = e.X
LblPos.Y = e.Y
lbl.Name = "TestLabel"
lbl.Text = Labeltext
lbl.Location = LblPos
lbl.BackColor = Color.LightGray
Me.Controls.Add(lbl)
Catch ex As Exception
End Try
End Sub
as you can see i have created label on the form design area on the Form mouse move event.
i tried using Form1_DragDrop Event ...but it was not getting fired when i use to leave the mouse.
I hope by now you must have got what i am looking for.
Regards
Ismail
>Hi Sayed,
>
>Please refer to the following KB article for information on this :
>
>
How do I perform the drag drop operation between an XPToolBar and TreeViewAdv ?
>
>Let me know if you need further assistance.
>
>Regards,
>Guru Patwal
>Syncfusion, Inc.