Solved

VB.net open Windows Form at point on DataGridView drag drop

Posted on 2014-02-10
2
525 Views
Last Modified: 2014-02-11
Hi

I am opening a Windows form in the DragDrop event over a DataGridView. I have done a hit test. How do I open the form at the point where the drag drop occurs using this information?


  Private Sub DataGridView1_DragDrop(sender As Object, e As System.Windows.Forms.DragEventArgs) Handles DataGridView1.DragDrop
        Try
            Dim oCellAddress As String

            '** NOTE - Find X and Y coorinates or Row and Column index: so can drag into an individual cell or a row
            '   The following code puts whatever text is sent into the destination cell
            Dim p As Point = Me.DataGridView1.PointToClient(New Point(e.X, e.Y))
            Dim hitTest As DataGridView.HitTestInfo = DataGridView1.HitTest(p.X, p.Y)
            Dim oRowIndex As Integer = hitTest.RowIndex
            Dim oColumnIndex As Integer = hitTest.ColumnIndex

              Dim Form_PickQuery As New frmPickQuery
            Form_PickQuery.Show(
0
Comment
Question by:murbro
2 Comments
 
LVL 25

Accepted Solution

by:
Luis Pérez earned 500 total points
ID: 39850145
What you need to do is:

Dim Form_PickQuery As New frmPickQuery
Form_PickQuery.StartPosition = FormStartPosition.Manual
Form_PickQuery.Left = e.X
Form_PickQuery.Top = e.Y
Form_PickQuery.Show()

Open in new window


Hope that helps.
0
 

Author Closing Comment

by:murbro
ID: 39850455
Thanks very much
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
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…

757 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

23 Experts available now in Live!

Get 1:1 Help Now