Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 109,580 C# Programmers for FREE! Ask your question and get quick answers from experts. There are 1,562 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Getting the coordinates from a DataGridView from the CellClick event.

 
Reply to this topicStart new topic

Getting the coordinates from a DataGridView from the CellClick event.

papuccino1
post 5 Jul, 2008 - 11:24 AM
Post #1


D.I.C Head

**
Joined: 2 Mar, 2008
Posts: 85


My Contributions


Hello.

Here's what I want to do.

1. User click on a cell from the DataGridView.
2. The entire information from that cells row is copied onto some TextBox's I've setup.


My dillema lies in how can I retrieve the position of that clicked cell?

For instance:

CODE

public void GetInformation(DataGridView dgv)
{
dgv.Location  //Maybe this?
//or
dgv.CellSelected //This?
}


Thank you for the help guys.
User is offlineProfile CardPM

Go to the top of the page


n8wxs
post 5 Jul, 2008 - 08:46 PM
Post #2


New D.I.C Head

*
Joined: 7 Jan, 2008
Posts: 16



Thanked 1 times
My Contributions


Have a look at:

<http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.cellcontentclick.aspx>

The DataGridViewCellEventArgs Class contains the properties:

ColumnIndex
RowIndex

Your DataGridView.CellContentClick event handler can use these indicies
to retrieve your data.

User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 9/8/08 12:29AM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month