I have a DataGridView control and I'm checking if I'm getting the correct value of column 0

But when I click my button to echo the value, I always get this error...

Are there errors in my code? Or what?
I have a DataGridView control and I'm checking if I'm getting the correct value of column 0

But when I click my button to echo the value, I always get this error...

Are there errors in my code? Or what?
I think the most possible reason is that when you click the button, the form is focus on the 2nd row (row with *), this row has no reference to it until you click & input something in a cell of the row (if so, another row with * will be generated automatically). If you don't want the row to be generated automatically, just set dataGridView1.AllowUserToAddRows to false.
Break up your long/compound statement into several lines/statements:
Try replacing
dgView.CurrentRow.Index with dgView.SelectedRows[0].Index
and set the property Multiselect to False, SelectionMode = FullRowSelect
Did that help? :)