Hi friends)
I have such error in my code-

Object reference not set to an instance of an object

code -

int n1, n2;
if (dataGridView1[2, 0].Value != "") 
[B]if (int.TryParse(dataGridView1[2, 0].Value.ToString(), out n1) == false)[/B]{}

If I do not specify the value of the cell - this code will not work ..... I do not understand, why? (if to specify - it will work)
why it's so?
And I don't understand - why the code continues to run after the test -

if (dataGridView1[2, 0].Value != "")

Big thanks in advance)))

I should use -

(dataGridView1[1, 0].Value != [B][U]null[/U][/B])

You should use this:

if (string.IsNullorEmpty(dataGridView1[2, 0].Value))

Are you sure the 'row' or 'cell' you are referring; exists, when you run the code ????

commented: +++++++++++ +1

yea, because I initialize dVG within the form loading) thank you!))

yea, because I initialize dVG within the form loading) thank you!))

Is your issue resolved ???
If NO, can you give more details like error messages etc.