|
-
Jul 13th, 2007, 02:15 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] [2005] Get cell content from selected row in DataGridView
Hello.
This is what I want to do:
On DataGrid double click, I want to return the value of the 1st cell from the selected row. I've done this code but it doesn't work very well.
Code:
Private Sub DataGridView1_CellContentDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentDoubleClick
Me.TextArtigo.Text = Me.DataGridView1.Item(e.ColumnIndex, 1).Value
End Sub
Thank you.
-
Jul 13th, 2007, 02:24 PM
#2
Re: [2005] Get cell content from selected row in DataGridView
This should do it for you... Notice that I'm handling the CellDoubleClick event (so that even if the user doubleclicks outside of the actual content of the cell (but still within the cell's boundary), it still works)
Code:
Private Sub DataGridView1_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellDoubleClick
Me.TextArtigo.Text = Me.DataGridView1.Item(0, e.RowIndex).Value.ToString()
End Sub
-
Jul 13th, 2007, 04:35 PM
#3
Thread Starter
Hyperactive Member
Re: [2005] Get cell content from selected row in DataGridView
Thank you.
That work's pretty good!
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
|