Tchala B

Tchala B

  • NA
  • 52
  • 15.2k

How to get a collection of selected cells in datagridview

Jun 12 2017 1:48 PM
My code currently allows a user to select an item at ago from a list of items in datagrid view.
I would want to change it so that it allows the user to select more than one item to be processed. i.e it now allows user to generate a report for one selected employee but i want to change that so that a user can generate more than one employee`s report at once
Here is my current source code
  1. private void dgvPrintEmp_CellDoubleClick(object sender, DataGridViewCellEventArgs e)  
  2.     {  
  3.             //added  
  4.       this.Clear_PrintEmp();  
  5.       if (e.RowIndex < 0)  
  6.         return;  
  7.       this.mStudId = Convert.ToInt32(this.dgvPrintEmp.Rows[e.RowIndex].Cells["empid_PrintEmp"].FormattedValue);  
  8.       this.lblEmpPrintEmp.Text = this.dgvPrintEmp.Rows[e.RowIndex].Cells["Empname_PrintEmp"].FormattedValue.ToString();  
  9.       this.btnPrintEmp.Enabled = true;  
  10.     } 
 

Answers (1)