How to Get the index of the SelectedRow in a DataGridView:
You can get the index of the Selected Row in a Data Grid View by using the following c# code.
You can get the index of the Selected Row in a Data Grid View by using the following c# code.
private void gvCustomer_SelectionChanged(object sender, EventArgs e) { if (gvCustomer.SelectedRows.Count == 1) { txtXML.Text = gvCustomer.Rows[gvCustomer.SelectedRows[0].Index].Cells["CustomerCode"].Value.ToString(); } }
1 comments:
Group gridview rows with header in C#
Post a Comment
Share your thoughts here...