title: How to replace DataGridViewRow in DataGridView (under VirtualMode) in Windows Form?
body: <p>I have <code>DataGridView</code> control used in Windows Form. The <code>DataGridView</code> is in virtual mode.</p>
  
  <p>Now, there is a requirement to change the usual row that is generated by <code>DataGridView</code> when you set the <code>RowCount</code> property.</p>
  
  <p>By setting the <code>RowCount</code> property, the <code>DataGridView</code> would generate default empty <code>DataGridViewRow</code>. </p>
  
  <p>Understood that under <code>VirtualMode</code> the <code>DataGridView</code> would trigger event <code>CellValueNeeded</code>. I have tried to change the row in that event.</p>
  
  <pre><code>dataGridView.Rows.Insert(e.RowIndex, new GroupCustomRow());
  </code></pre>
  
  <blockquote>
    <p>GroupCustomRow is a custom class inherited from DataGridViewRow.</p>
  </blockquote>
  
  <p>However, I encountered this problem:</p>
  
  <blockquote>
    <p>Operation is not valid because it results in a reentrant call to the
    SetCurrentCellAddressCore</p>
  </blockquote>
  
  <p>So, is it possible to use <code>DataGridView</code> in <code>VirtualMode</code> and have custom row painted? </p>
  
  <p>Thanks for your attention.</p>
  
  <p>Best Regards,</p>
  
  <p>Hatjhie</p>