title: Datagridview Combobox value
body: <p>I have a datagridview inside a groupbox on a form application. I have made this code.</p>
  
  <pre><code>private bool checkrow(DataGridViewRow testrow)
  {
      for (int i = 0; i &lt; testrow.Cells.Count; i++)
      {
          if (testrow.Cells[i].Value != null)
          {
              MessageBox.Show(testrow.Cells[i].Value.ToString());
              if (testrow.Cells[i].Value.ToString() != string.Empty)
              {
                  MessageBox.Show(testrow.Cells[i].Value.ToString());
                  return true;
              }
          }
      }
      return false;
  }
  
  private void toolStripButton1_Click(object sender, EventArgs e)
  {
      if (checkrow(dgvTimeTracker.CurrentRow) == true)
      {
          string cbtext = dgvTimeTracker.Rows[dgvTimeTracker.SelectedCells[0].RowIndex].Cells[1].Value.ToString();
          MessageBox.Show(cbtext);
  
          string[] newrow = new string[] { DateTime.Now.ToShortDateString(), cbtext, DateTime.Now.ToLongTimeString(), "", "", "" };
      }    
      else
      {
          MessageBox.Show("Error!");
      }    
  }
  </code></pre>
  
  <p>If I run this code on a new project it runs perfectly. But if I run it in my other project it only returns the "error" message , or nullreference exception when getting the value of the combobox item {1} column of the datagridview</p>
  
  <p>Can anyone help me please??</p>