how to get value from datagridview using row header mouse double click

  • Thread starter Thread starter arch253
  • Start date Start date
A

arch253

Guest
here i got error when i click on grid row

{"Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"}


here the code

private void dataGridViewSubLocation_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
{
//string id = dataGridViewSubLocation.SelectedRows[e.RowIndex].Cells[0].Value.ToString();
id = Convert.ToInt32(dataGridViewSubLocation.SelectedRows[e.RowIndex].Cells[0].Value);
masterLocComboBox.Text = dataGridViewSubLocation.SelectedRows[e.RowIndex].Cells[1].Value.ToString();
txtLocName.Text = dataGridViewSubLocation.SelectedRows[e.RowIndex].Cells[2].Value.ToString();
txtLocAddress.Text = dataGridViewSubLocation.SelectedRows[e.RowIndex].Cells[3].Value.ToString();
}

Continue reading...
 
Back
Top