Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Private Sub DragSource(ByVal sender As Object, ByVal e As GiveFeedbackEventArgs) Handles DragSource.GiveFeedback
e.UseDefaultCursors = False
If ((e.Effect And DragDropEffects.Move) = DragDropEffects.Move) Then
Cursor.Current = New Cursor(...)
Else
Cursor.Current = New Cursor(...)
End If
End Sub
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)
'Note: The DragDropEffects enumeration merely describes
' the cursors (effects) that can be presented during the operation,
' it will not enforce that the object will ultimately be moved as a
' result of the successful drag drop operation.
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(GetType(Label)) Then
'Debug.WriteLine(sender.GetType)
'Debug.WriteLine(e.Data, e.AllowedEffect)
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(DataFormats.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
'**** put this in just in case - no good ****
Private Sub TextBox2_GiveFeedback(ByVal sender As Object, ByVal e As System.Windows.Forms.GiveFeedbackEventArgs) Handles TextBox2.GiveFeedback
Debug.WriteLine("TextBox2_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
'**** this should be the one that gies feedback ****
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