vb.NET Drag&Drop between two tabpages in the same tabcontrol

60 Views Asked by At

I have two datagridviews and I drag & drop between them. But now I have to put them in two tabpages in the same tabcontrol. Pages must change during drag & drop when I move mouse to the desired page title while left button is down. How can I do? Thank you

1

There are 1 best solutions below

0
Claudio On

Thanks for the replay! This is my code:

Private Sub DataGridView1_GiveFeedback(sender As Object, e As GiveFeedbackEventArgs) Handles DataGridView1.GiveFeedback
        Dim position As Point = TabControl1.PointToClient(Control.MousePosition)
        For id As Integer = 0 To TabControl1.TabCount - 1
            If TabControl1.GetTabRect(id).Contains(position) Then
                TabControl1.SelectedIndex = id
                Exit For
            End If
        Next
    End Sub

it works but not if I just move between the titles of tabpages