title: how to programatically edit the cell value of a datagridview in virtual mode?
body: <p>I have a DataGridView in virtual mode.
  I only implemented the CellValueNeeded eventhandler as described in <a href="http://msdn.microsoft.com/en-us/library/15a31akc.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/15a31akc.aspx</a>.</p>
  
  <p>Implementing the rest of the events only seems needed when you want to be able to edit the cells manually.</p>
  
  <p>I would like to programatically edit a DataGridView cell value. </p>
  
  <p>I tried this using the following code:</p>
  
  <pre><code>DataGridView1.EditMode = DataGridViewEditMode.EditProgrammatically;
  DataGridView1.BeginEdit(false);
  DataGridView1.Rows[0].Cells[0].Value = "testing new value";
  //just using a random parameter here, not sure it is needed when editing programmatically
  DataGridView1.CommitEdit(DataGridViewDataErrorContexts.LeaveControl);
  DataGridView1.Refresh();
  </code></pre>
  
  <p>but no success :(</p>
  
  <p>any help would be appreciated</p>