1

My second if-statment are acting wierd.

"Dereference of a possibly null reference."

Should'nt my first if-statment prevent that from happening?

foreach (DataGridViewRow row in dataGridViewMovies.Rows)
        {
            if( row != null)
            {
                if (row.Cells[0].Value.ToString().ToUpper().Contains(searchWord.ToUpper()))
                {
                    row.Visible = true;
                }

                else
                {
                    row.Visible = false;
                }
            }
           
        }
skoanton
  • 13
  • 2

0 Answers0