DATAGRIDVIEW APPLIED IN C#

Kenny Tangnde

Total Post:68

Points:476
Posted by  Kenny Tangnde
C# 
C#
 2531  View(s)
Ratings:
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.

  1. Awadhendra Tiwari

    Post:126

    Points:882
    Re: datagridview applied in c#

    Hi aken H,

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

    Thanks.

  1. John Smith

    Post:103

    Points:727
    Re: datagridview applied in c#

    Please paste your code here..

  1. Kenny Tangnde

    Post:68

    Points:476
    Re: datagridview applied in c#

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

  1. Kenny Tangnde

    Post:68

    Points:476
    Re: datagridview applied in c#

    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
            }

  1. Kenny Tangnde

    Post:68

    Points:476
    Re: datagridview applied in c#

    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

  1. Awadhendra Tiwari

    Post:126

    Points:882
    Re: datagridview applied in c#

    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.

  1. Kenny Tangnde

    Post:68

    Points:476
    Re: datagridview applied in c#

    hi Awadhendra Tiwari ,

         thanks for your answer.

    i very  appreciate your bolg write article.

    thanks.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!