How to make dragdrop - mousedown & cell click work in same datagridview

I have a winform application written in VS 2010. It has two datagridviews on the form: Gridview1 and Gridview2.    There is a checkbox column on Gridview1 in addition to other text columns.    I recently added a dragDrop event to enable user to dragdrop rows from Gridview1 to Gridview2. However, I found the Click event is no longer evoked on gridview1 after I added MouseDown event to do dragdrop.

 I understand that both Click cell and dragdrop actions evok the mouseDown event, but the chanllenge is how I can make the program to recognize these two different actions?

Any help is greatly appreciated.!!
jrmc-pgmrAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CodeCruiserCommented:
What do you have in mouse down? And what do you want the click event for?
0
jrmc-pgmrAuthor Commented:
Mouse down to drag drop data from gridview1 to gridview 2.
Click event for check the checkbox cell in gridview1.
0
CodeCruiserCommented:
Show us the code from mouse down. It should not be a problem generally.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

jrmc-pgmrAuthor Commented:
   Private Sub VisitHIGridView_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles VisitHIGridView.MouseDown

          Dim hit As DataGridView.HitTestInfo = VisitHIGridView.HitTest(e.X, e.Y)
          Dim clickedRow As DataGridViewRow = New DataGridViewRow
         rowIndexFromMouseDown = VisitHIGridView.HitTest(e.X, e.Y).RowIndex

        If hit.Type = DataGridViewHitTestType.Cell Then
                 clickedRow = VisitHIGridView.Rows(hit.RowIndex)
                VisitHIGridView.DoDragDrop(clickedRow, DragDropEffects.Copy)
        End If

    End Sub

'Destination gridview
    Private Sub PlanGridView_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles PlanGridView.DragEnter

                   e.Effect = DragDropEffects.Copy
        End Sub
0
CodeCruiserCommented:
Try moving that code to MouseClick event.
0
jrmc-pgmrAuthor Commented:
The drag drop is  no longer working after I moved the code to Mouseclick event.
0
jrmc-pgmrAuthor Commented:
I have figured it our myself. By using MouseDown and MouseMove events. so I now I can do both dragdrop and click cell in same grid now. Thanks
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jrmc-pgmrAuthor Commented:
I figured it out myself
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.