Rahul Kumar Rahul Kumar - 1 year ago 103
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 Source
int index = datagridview1.SelectedCells[0].RowIndex;
DataGridViewRow row1 = datagridview1.Rows[index];   
string str = Convert.ToString(selectedRow.Cells[Column name].Value); 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download