Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

selected row index

$
0
0
i am trying to get selected row index but i got error

 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            MessageBox.Show(dataGridView1.SelectedRows[0].Index.ToString());
        }



Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index


whats wrong. i try on other events like mouse click etc every time i got this error why this error occur

Viewing all articles
Browse latest Browse all 12583

Trending Articles



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