title: Why does showing the drop-down list require two clicks in a DataGridView?
body: <p>I am using a drop-down list in <code>DataGridView</code> control, but the problem is that for the first time I click the drop-down, it takes two clicks to drop down the list and show, but afterwards it works fine.</p>
  
  <pre><code> private void ViewActiveJobs_CellClick(object sender, DataGridViewCellEventArgs e)
          {
              if (e.RowIndex&gt;=0)
              {
                  jobCardId = int.Parse(ViewActiveJobs.Rows[ViewActiveJobs.CurrentCell.RowIndex].Cells["Job Card Number"].Value.ToString());
                  RegNo = ViewActiveJobs.Rows[ViewActiveJobs.CurrentCell.RowIndex].Cells["Registeration Number"].Value.ToString();
                  SelectedRow = e.RowIndex;                
              }
          }
  
          private void ViewActiveJobs_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
          {
              try
              {
                  ComboBox cbox = (ComboBox)e.Control;
                  cbox.SelectedIndexChanged -= new EventHandler(comboBOX_SelectedIndexChanged);
                  cbox.SelectedIndexChanged += new EventHandler(comboBOX_SelectedIndexChanged);
              }
              catch(Exception)
              {
              }
          }
          private void comboBOX_SelectedIndexChanged(object sender, EventArgs e)
          {
              ComboBox combo = sender as ComboBox;
              string str = combo.SelectedIndex.ToString();
             if (combo.SelectedIndex ==1)
                  pdf = new MakePDF(jobCardId,RegNo);
             if (combo.SelectedIndex == 2)
             {
                 PdfJobCard = new MakePDFJobCard(jobCardId);
             }
              if (combo.SelectedIndex == 3)
             {
                 if (MessageBox.Show("Are you Sure you want to Close Job Card ?", "Are you Sure",
                          MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                 {
                     cmd = new SqlCommand();
                     cmd.Connection = con;
  
                     cmd.Parameters.Add("@jCard", SqlDbType.VarChar).Value = jobCardId;
                     cmd.Parameters.Add("@stat", SqlDbType.VarChar).Value = "Closed";
                     cmd.CommandText = "UPDATE JobCard SET status = @stat WHERE Id = @jCard";
  
                     try
                     {
                         cmd.ExecuteNonQuery();
                         ViewActiveJobs.Visible = false;
                         ViewActiveJobs.AllowUserToAddRows = true;
                         ViewActiveJobs.Rows.RemoveAt(SelectedRow);
                         //ViewActiveJobs.Visible = true;
                     }
                     catch (Exception c)
                     {
                         MessageBox.Show(c.Message);
                     }
                 }
             }
          }
  </code></pre>