title: DataGridView display row header cell
body: <p>I'm trying to display a simple DataGridView linked to a DataTable and I want, ultimately, my first column in the DataTable to be the row header cell for the DataGridView.  At this point I will settle for having any value in the row header cell.  I can display the DataGridView with all my rows and columns, and with column header cells, but no row header cell.  I check the value in the row.HeaderCell.Value, and the data I put there is there.  I check row.HeaderCell.Displayed and it is false, but this is read only, so I can't make it true.  How do I make the row header cell display?</p>
  
  <p>Here's a simple sample of what I've tried to get this to work:</p>
  
  <pre><code>        DataTable table = new DataTable();
          for (int i = 0; i&lt;10; i++)
          {
              table.Columns.Add(new DataColumn("column-" + i));
          }
  
          for (int i = 0; i &lt; 10; i++)
          {
              DataRow theRow = table.NewRow();
  
              for (int j = 0; j &lt; 10; j++)
                  theRow[j] = i + "-" + j;
              table.Rows.Add(theRow);
  
          }
  
          dataGridView1.DataSource = table;
          dataGridView1.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders;
          int rowNumber = 1;
          foreach (DataGridViewRow row in dataGridView1.Rows)
          {
              if (row.IsNewRow) continue;
              row.HeaderCell.Value = "Row " + rowNumber;
              rowNumber = rowNumber + 1;
          }
          dataGridView1.AutoResizeRowHeadersWidth(
              DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders);
  </code></pre>