Drag and Drop Problem
I'm having some problems implementing drag and drop in my vb app. I am
trying to implement a drop and drop operation so that I can drag a bunch
of selected rows from a datagrid into a TreeView control. Right now, I am
tackling the problem like this:
Private Sub dataBusinessList_MouseDown(ByVal sender As Object, ByVal e
Dim dEffect As DragDropEffects
If e.Button = MouseButtons.Left Then
Then in the treeview,
Private Sub tvwCategories_DragEnter
If (e.Data.GetDataPresent(DataFormats.Text)) Then
' Allow drop.
e.Effect = DragDropEffects.Move
' Do not allow drop.
e.Effect = DragDropEffects.None
Private Sub tvwCategories_DragDrop
The function headers have been shortened I'm running into a couple of
problems on the datagrid side. The datagrid allows you to click and drag
to select contiguous rows. When I implemented this code, it seems to interfere
with that native operation, which is no surprise. But still, I'd like to
find a solution to it, if there is one. A second problem is that if you
place your mouse approximately where the grid lines divide one row from another
row, you can click and then resize the rows. However, when I implemented
my drag and drop code, if I happen to click on the gridline, I will initiate
a resize operation for that row, but I cannot get out of it by releasing
the mouse button. I have to right click for it to end the resize operation.
Is there anyway around these problems?
I was actually toying with the idea of testing to see what the current mouse
cursor is in the MouseDown event. If it's change to a Resize type cursor,
then don't call DoDragDrop. But I can't seem to figure out how to find out
what the current mouse cursor is. Any help is greatly appreciated. Thanks