Could someone tell me please how to get GiveFeedback to fire?
I have searched google for a good example using "drag drop net GiveFeedback", and nothing I can use comes back.
Is D&D that bad? It seems so easy until you try to change the cursor like I want to do.
I can't use the default D&D cursors. My users are used to seeing whatever icon is in the list, moved down to editing.
I'll repost code here that I posted in another thread (sorry).
If I am doing it wrong, then please tell me. I'm pulling my hair out over this. It should not be this hard.
LOL - VB6 was a lot easer to learn. But maybe I was a bit younger then. LOL
Thanks ahead of time.
I placed a label and a textbox on a form - no other code
Sometimes it's fun to mess around and see what things do. I learned a lot that way. But it's frustrating when there is a piece missing that I can't find.
Thanks and a star to whoever can get this to work.
And I promiss I'll write a FAQ on D&D.
I know it's something stupid; it always is.
I have searched google for a good example using "drag drop net GiveFeedback", and nothing I can use comes back.
Is D&D that bad? It seems so easy until you try to change the cursor like I want to do.
I can't use the default D&D cursors. My users are used to seeing whatever icon is in the list, moved down to editing.
I'll repost code here that I posted in another thread (sorry).
If I am doing it wrong, then please tell me. I'm pulling my hair out over this. It should not be this hard.
LOL - VB6 was a lot easer to learn. But maybe I was a bit younger then. LOL
Thanks ahead of time.
I placed a label and a textbox on a form - no other code
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox2.AllowDrop = True
End Sub
Private Sub Label1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseDown
Debug.WriteLine("Label1_MouseDown b4 Drop")
' This is the start of a D&D operation
' Start a drag.
' Data to drag, What effects?
DoDragDrop(Label1.Text, DragDropEffects.Copy)
'This will not fire until the D&D is finished.
Debug.WriteLine("Label1_MouseDown after Drop")
End Sub
Private Sub TextBox2_DragOver(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles TextBox2.DragOver
Debug.WriteLine("TextBox2_DragOver")
End Sub
Private Sub TextBox2_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles TextBox2.DragEnter
Debug.WriteLine("TextBox2_DragEnter")
' This is the second phase of a D&D operation
'Check for any data to drop
If e.Data.GetDataPresent(DataFormats.Text) Then
' There is Label data. Allow copy.
e.Effect = DragDropEffects.Copy
' Highlight the control.
TextBox2.BorderStyle = BorderStyle.FixedSingle
Else
' There is no Label. Prohibit drop.
e.Effect = DragDropEffects.None
End If
End Sub
Private Sub TextBox2_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles TextBox2.DragDrop
Debug.WriteLine("TextBox2_DragDrop")
TextBox2.Text = e.Data.GetData(ataFormats.Text).ToString
End Sub
Private Sub TextBox2_DragLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.DragLeave
Debug.WriteLine("TextBox2_DragLeave")
End Sub
' Tried GiveFeedback with both the label and textbox. Neither would fire when a breakpoint was placed inside of the sub.
Private Sub Label1_GiveFeedback(ByVal sender As Object, ByVal e As System.Windows.Forms.GiveFeedbackEventArgs) Handles Label1.GiveFeedback
Debug.WriteLine("Label1_GiveFeedback")
e.UseDefaultCursors = False
If ((e.Effect And DragDropEffects.Move) = DragDropEffects.Move) Then
Cursor.Current = Cursors.Hand
Else
Cursor.Current = Cursors.SizeAll
End If
End Sub
Sometimes it's fun to mess around and see what things do. I learned a lot that way. But it's frustrating when there is a piece missing that I can't find.
Thanks and a star to whoever can get this to work.
And I promiss I'll write a FAQ on D&D.
I know it's something stupid; it always is.