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.

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(); 
    } 
}

0 comments

Related Posts Plugin for WordPress, Blogger...