Subject: Data Grid View
Posted By: CoolDude Post Date: 3/9/2007 5:15:06 AM
Hello Every Body,

I used  "gridTable.Rows(SelectedRow).Cells(0).Value" this code to get value of column(0) of selected row in vb.net 2005. Here gridTable is DataGridView.

Can Any body suggest me How To write same line / code in C#.net.

cool dude
Reply By: joefawcett Reply Date: 3/9/2007 5:35:19 AM
gridTable.Rows[SelectedRow].Cells[0].Value;

--

Joe (Microsoft MVP - XML)
Reply By: CoolDude Reply Date: 3/10/2007 3:33:21 AM
Finally I got the solution myself

int selectedRow = this.gridTable.CurrentRow.Index;

gridTable.Rows(SelectedRow).Cells(0).Value;

Reply By: joefawcett Reply Date: 3/10/2007 4:37:37 AM
I don't understand that at all. You asked for c# based on VB.NET, therefore I presumed that SelectedRow was initialised correctly otherwise the VB.NET wouldn't work. Presumably you could use:
this.gridTable.CurrentRow.Cells[0].Value;


--

Joe (Microsoft MVP - XML)

Go to topic 57514

Return to index page 5
Return to index page 4
Return to index page 3
Return to index page 2
Return to index page 1