Rahul Kumar Rahul Kumar - 3 months ago 17
C# Question

How do I find the value for the selected row in datagrid in C#

I want to get value of selected value in Datagrid in C#.

Thanks in advance

Answer
int index = datagridview1.SelectedCells[0].RowIndex;
DataGridViewRow row1 = datagridview1.Rows[index];   
string str = Convert.ToString(selectedRow.Cells[Column name].Value); 
Comments