Here is the code in my DataGridView's SelectionChanged event:
Dim a as Integer
a = DataGridView1.CurrentRow.Index 'this certain line contains the error
TextBox1.Text = DataGridView1.Item(0,a).Value
'and all that jazz
The code runs, but when a cell is clicked followed by any column header, the error shows up.
I tried placing this block of code in another event called CellContentClick but clicking on the cells in the datagridview is not that responsive as compared to SelectionChanged.
Any ideas on how to fix this?