Rahul Kumar Rahul Kumar - 8 months ago 55
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

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