Solved

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

Posted on 2014-02-10
2
536 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Obtain cell value using column ID in DataGrid using VB.NET 2 38
How to duplicate form in Visual Studio 2015 2 98
UDP Data Capture Thread Issue 7 30
ModalPopup  question 22 39
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

730 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