Null Reference Exception?
Posted on 2008-09-30
I have a form (form1) which opens another form (say, form2). Form2 then refers to a dataGridView on Form1, getting its .currentRow.Index property. This has worked for a long time.
I recently changed something, which has broken it. I get a null reference exception when I try to access the currentRow property of the dataGridView on Form1.
Now, I've checked. The dataGridView's currentRow property is set fine before I switch to form2. I've inserted break points and checked it lots of times.
I have also double checked that inside form two this is true:
Form1.dataGridView.CurrentRow Is Nothing
The strange thing is, it isn't nothing. I can plainly see its loaded with data.
I was making changes earlier, and I'm sure I just changed a property of the dataGridView, or the second form. I have no idea what it might have been though. Does anyone have any ideas?
Thanks in advance,