Solved

RichTextBox drag_drop event not firing

Posted on 2014-11-04
2
145 Views
Last Modified: 2014-11-08
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
Comment
Question by:murbro
2 Comments
 
LVL 12

Accepted Solution

by:
ktaczala earned 500 total points
ID: 40423131
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
 

Author Closing Comment

by:murbro
ID: 40430881
Thanks very much
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now