Solved

DataGridView Question

Posted on 2006-06-24
6
633 Views
Last Modified: 2010-04-16
How to determine in which row and column of the datagridview the mouse pointer is in the datagridview mousedown event?
0
Comment
Question by:michellechan57
6 Comments
 
LVL 6

Expert Comment

by:MuhammadAdil
ID: 16974809
Hi dear

see this sample code

private void myDataGridView_MouseDown(object sender, MouseEventArgs e)
        {
            int ColumnIndex =myDataGridView.SelectedColumns[0].Index;  // Selected Column Index
            int RowIndex = myDataGridView.SelectedRows[0].Index;  // Selected Row Index
        }

Regards

Adil
0
 

Author Comment

by:michellechan57
ID: 16974844
Hi

Thanks for responding.
The sample code returns the selected row and column.
I wanted to get the row and column at point (e.X,e.Y).
Any idea?
0
 

Author Comment

by:michellechan57
ID: 16975009
I managed to find a solution:

DataGridView.HitTestInfo myHit = dataGridView1.HitTest(e.X, e.Y);
if (myHit.Type == DataGridViewHitTestType.Cell)
{
    // select row == myHit.RowIndex;
}

Can I request for a refund?
0
 
LVL 11

Expert Comment

by:Agarici
ID: 16982051
to get a refound post a request here:http://www.experts-exchange.com/Community_Support/

A.
0
 
LVL 1

Accepted Solution

by:
GhostMod earned 0 total points
ID: 17047263
Closed, 125 points refunded.

GhostMod
Community Support Moderator
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

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

20 Experts available now in Live!

Get 1:1 Help Now