Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 157
  • Last Modified:

RichTextBox drag_drop event not firing

On my form load I have the code: Me.RichTextBox2.AllowDrop = True

Then I have the code below but the DragDrop event doesn't fire (even though other regular text boxes accept the drop)

    Private Sub RichTextBox2_DragEnter(sender As Object, e As System.Windows.Forms.DragEventArgs) Handles RichTextBox2.DragEnter
        e.Effect = DragDropEffects.Copy
    End Sub

    Private Sub RichTextBox2_DragDrop(sender As Object, e As System.Windows.Forms.DragEventArgs) Handles RichTextBox2.DragDrop
    <CODE HERE DOES NOT FIRE>
End Sub
0
Murray Brown
Asked:
Murray Brown
1 Solution
 
ktaczalaCommented:
It's possible if there's no valid data the dragdropeffects.copy may not take affect.
also try setting allowdrop in the designer to make sure it's taking.
try this in the drag enter event:
   If (e.Data.GetDataPresent(DataFormats.Text)) Then
      e.Effect = DragDropEffects.Copy
   Else
      e.Effect = DragDropEffects.None
   End If
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks very much
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now