Rahul Kumar Rahul Kumar - 4 months ago 27
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);