|
-
Jan 12th, 2011, 07:05 PM
#1
Thread Starter
Addicted Member
Datagridview, get the text from the first cell of the selected row
Hi all, after some searching around the msdn im no closer to an answer so time to ask you guys for some help.
I have a data grid view and i want to show the text from the first column of the selected row (regardless of what cell in that row is selected) in a text box.
So for example in this picture:

The 1st column of the selected rows text is 'California' so that should be sent to the textbox.
Any helps much appreciated, Thanks.
-
Jan 12th, 2011, 08:09 PM
#2
Re: Datagridview, get the text from the first cell of the selected row
There's a difference between "selected" and "current" in a DataGridView. "Selected" means highlighted and you can, depending on the circumstances, have multiple cells or rows selected at the same time. "Current" means containing the caret, and only one cell and row can contain the caret at a time. The grid's CurrentRow property will return a DataGridViewRow, obviously containing the current row. As with all rows, that has a Cells collection, which you can index by column name or ordinal.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|