title: Cannot perform runtime binding on a null reference exception
body: <p>I'm trying to find the dimensions of an Excel table using C# by finding the first null cell within the first column (which consists of dates) and the header row.</p>
  
  <p>Here's the code I'm using right now:</p>
  
  <pre><code>public static void findingTableBounds()
      {
          string dateCol = "";
          ArrayList dateColumn = new ArrayList();
          ArrayList numberOfColumns = new ArrayList();
  
          for (int column = 1; column &lt; currentRow; column++)
          {
              dateCol = ((Excel.Range)workSheet.Cells[currentRow, 1]).Value2.ToString();
              if (dateCol != "")
              {
                  dateColumn.Add(dateCol);
                  currentRow++;
                  totalRow++;
                  Console.WriteLine("Total Row: {0}", totalRow);            
              }
              else
              {
                  Console.WriteLine("Total Row: {0}", totalRow);
                  currentRow = 2;
              }
          }
  </code></pre>
  
  <p>**Note: There is a closing bracket for this method, I didn't include it because there's another for loop that does the exact same thing as the above code but only for how many columns there are.</p>
  
  <p>The error occurs at "dateCol = ((Excel.Range)workSheet.Cells[currentRow, 1]).Value2.ToString();"  I'm pretty sure it happens because I'm trying to assign a null value (the cell) to dateCol (a string) when string is a non-nullable type.  Unfortunately I'm not sure how to solve the problem.</p>