title: how select multiple row using shift and Ctrl key in datagridview C#
body: <p><img src="https://i.stack.imgur.com/W1oK7.jpg" alt="enter image description here"><img src="https://i.stack.imgur.com/yQpeM.jpg" alt="enter image description here">My requirement : In datagridview I need select row by clicking the row header and selected row should maintain until I will click the other row header also same time I should select cell too.</p>
  
  <p>My Problem : I can't select multiple row using Shift and Ctrl key.</p>
  
  <p>my code : </p>
  
  <pre><code>    List&lt; DataGridViewRow&gt; selectedRows = new List&lt; DataGridViewRow&gt;();
  
      void selectRows()
      {
          dataGridView1.SuspendLayout();
          foreach (DataGridViewRow r in dataGridView1.Rows)
          {
              r.Selected = selectedRows.Contains(r);
          }
          dataGridView1.ResumeLayout();
      }
  
      private void dataGridView1_RowHeaderMouseClick(object sender,DataGridViewCellMouseEventArgs e)
      {
          DataGridViewRow clickedRow = dataGridView1.CurrentRow;
  
          if (selectedRows.Contains(clickedRow))
          {
              selectedRows.Remove(clickedRow);
          }
          else
          {
              selectedRows.Add(clickedRow);
          }
          selectRows();
  
          foreach (DataGridViewRow row in dataGridView1.Rows)
          {
              if ((row.Index != e.RowIndex) &amp;&amp; !row.Selected)
              {
                  row.DefaultCellStyle.BackColor = Color.White;
              }
              else
              {
                  selectedRows.Remove(clickedRow);
                  row.Selected = true;
                  row.DefaultCellStyle.BackColor = Color.Blue;
              }
          }
      }
  
      private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
      {
          foreach (DataGridViewRow row in dataGridView1.Rows)
          {
              if (row.DefaultCellStyle.BackColor == Color.Blue)
              {
                  row.Selected = true;
              }
          }
      }
  </code></pre>