Home > DeveloperSection > Forums > datagridview applied in c#
Kenny Tangnde

Total Post:68

Points:476
Posted on    September-07-2011 9:41 AM

 C# C# 
Ratings:


 8 Reply(s)
 2140  View(s)
Rate this:

hi all

   datagridview the first one column  is used  ,ColumnType:DataGridViewCheckBoxColumn, I  now think Achieve  pressing the command button select all rows data.

thanks in advance.



Awadhendra Tiwari

Total Post:126

Points:882
Posted on    September-07-2011 9:48 AM

Hi aken H,

Could you please explain your question in more detail. I could not get your question properly.

Thanks.


John Smith

Total Post:101

Points:711
Posted on    September-07-2011 10:02 AM

Please paste your code here..

Kenny Tangnde

Total Post:68

Points:476
Posted on    September-07-2011 10:02 AM

Sorry, my question may be not detailed enough
How used dataGridView Control of ColumnType:DataGridViewCheckBoxColumn attribute

Kenny Tangnde

Total Post:68

Points:476
Posted on    September-07-2011 10:14 AM

hi all,

//code

    /// <summary>
        /// this method select all datagridview row header, it is used for select all rows
        /// </summary>
      
       private void btnSelectALL_Click(object sender, EventArgs e)
        {
            // first column name is "Select",ColumnType:DataGridViewCheckBoxColumn
            //how write the  code
        }



Kenny Tangnde

Total Post:68

Points:476
Posted on    September-08-2011 2:33 AM

Hi Awadhendra Tiwari,

   yes,this is i want.

// the click command , i want select all Checking  of checkbox column 

private void btnSelectALL_Click(object sender, EventArgs e)
        {
            
            //how write the  code
        }

thanks


Awadhendra Tiwari

Total Post:126

Points:882
Posted on    September-08-2011 7:07 AM

Hi,
  private void button1_Click(object sender, EventArgs e)
   
{
       
List<DataGridViewRow> rows_with_checked_column = new List<DataGridViewRow>();
       
foreach (DataGridViewRow row in dataGridView1.Rows)
       
{
           
if (Convert.ToBoolean(row.Cells[CheckBoxColumn1.Name].Value) == true)
           
{
                rows_with_checked_column
.Add(row);
           
}
       
}
       
// Do what you want with the check rows


   
Thanks.

Kenny Tangnde

Total Post:68

Points:476
Posted on    September-11-2011 3:59 AM

hi Awadhendra Tiwari ,

     thanks for your answer.

i very  appreciate your bolg write article.

thanks.


Don't want to miss updates? Please click the below button!

Follow MindStick