title: C# CellValueNeeded blocks Form
body: <p>I have a class inherited for Form. This class contains, among other things, a Button and a custom DataGridView.</p>
  
  <p>The DataGridView displays item depending on a DataBase and it can take a long time to load. I actualy have :</p>
  
  <pre><code>public partial class dlgDetailsObj : Form
  {
      List&lt;object&gt; listItem;
      public dlgDetailsObj(List&lt;object&gt; obj)
      {
          listItem = obj;
          customGridView.CellValueNeeded += onCellValueNeeded;
          customGridView.VirtualMode = true;
      }
  
      protected override void OnShown(EventArgs e)
      {
          base.OnShown(e);
  
          customGridView.RowCount = listItem.Count; // When RowCount changes, items are loaded
      }
  
      private void onCellValueNeeded(object sender, DataGridViewCellValueEventArgs e)
      {
          if (e.RowIndex &gt;= listItem.Count)
              return;
  
          String value = "";
          customItem item = listItem[e.RowIndex];
          if (e.ColumnIndex == columnId.Index)
          {
              value = item.Name; // If Name is null, it is loaded from dataBase (can take time)
          }
          /* Some else if*/
  
          e.Value = value;
  }
  </code></pre>
  
  <p>My problem is that when the customGridView starts to load, the close button is not loaded and user can't click on it (to cancel if loading is too long).</p>
  
  <p>How can I put my piece of code to be sure user can cancel ?</p>
  
  <p>Edit :
  I'm using virtual GridView (I updated my code)</p>