Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

DataGridView Question

Posted on 2006-06-24
6
Medium Priority
?
646 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
[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
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

618 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