title: How can I "double-click, edit and save while-leaving" a Windows Forms DataGridView CurrentCell?
body: <p>I'm barely new with WinForm's DataGridView control and quite honestly I'm having a hard time trying to mix and match its events and methods (e.g. <code>CommitEdit()</code> method didn't do what I've expected) to implement the simple concept of "entering edit mode by double-clicking the cell, modify its value (hopefully doing some sort of validation) and saving changes when leaving the aforementioned cell. My actual code looks like this and it's definitely incomplete:</p>
  
  <pre><code>// DEBUG
  
  private void myDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  {
      this.myDataGridView.BeginEdit(true);
      this.myDataGridView.CurrentCell.ReadOnly = false;
  }
  
  private void myDataGridView_CellLeave(object sender, DataGridViewCellEventArgs e)
  {
      this.myDataGridView.EndEdit();
  }
  
  private void myDataGridView_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
  {
      DataGridViewCellStyle editCellStyle = new DataGridViewCellStyle();
      editCellStyle.BackColor = System.Drawing.Color.DarkOrange;
      editCellStyle.ForeColor = System.Drawing.Color.Black;
      this.myDataGridView.CurrentCell.Style.ApplyStyle(editCellStyle);
  }
  
  private void myDataGridView_CellEndEdit(object sender, DataGridViewCellEventArgs e)
  {
      DataGridViewCellStyle defaultCellStyle = new DataGridViewCellStyle();
      defaultCellStyle.BackColor = System.Drawing.Color.White;
      this.myDataGridView.CurrentCell.Style.ApplyStyle(defaultCellStyle);
  }
  
  // DEBUG
  </code></pre>
  
  <p>So as you might notice any help you could provide will be really valuable and definintely appreciated. Thanks much you guys in advance!</p>