Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

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

$
0
0

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


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>