.:: Jasa Membuat Aplikasi Website,Desktop,Android Order Now..!! | | Order Now..!! Jasa Membuat Project Arduino,Robotic,Print 3D ::.

C# - How To Delete DataGridView Row Checked Cell In C#

0 komentar


بِسْــــــــــــــــمِ اﷲِالرَّحْمَنِ اارَّحِيم
bismillaahirrahmaanirrahiim

السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
Assalamu'alaikum warahmatullahi wabarakatuh

c# delete datagridview checked row

C# - How To Remove The Checked Row From Datagridview Using C#

____________________________________________________

In This C# Code We Will See How To Delete The 
Datagridview Row With CheckBox Checked In  CSharp  Programming Language .



Project Source Code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Csharp_delete_datagridview_checked_checkbox_cell : Form
    {
        public Csharp_delete_datagridview_checked_checkbox_cell()
        {
            InitializeComponent();
        }

        private void Csharp_delete_datagridview_checked_checkbox_cell_Load(object sender, EventArgs e)
        {
            // create a text columns
            DataGridViewTextBoxColumn dgvcId = new DataGridViewTextBoxColumn();
            dgvcId.HeaderText = "Id";
            DataGridViewTextBoxColumn dgvcFn = new DataGridViewTextBoxColumn();
            dgvcFn.HeaderText = "First Name";
            DataGridViewTextBoxColumn dgvcLn = new DataGridViewTextBoxColumn();
            dgvcLn.HeaderText = "Last Name";

            // create checkbox column
            DataGridViewCheckBoxColumn dgvcCheckBox = new DataGridViewCheckBoxColumn();
            dgvcCheckBox.HeaderText = "Delete";

            // add columns to datagridview
            dataGridView1.Columns.Add(dgvcId);
            dataGridView1.Columns.Add(dgvcFn);
            dataGridView1.Columns.Add(dgvcLn);
            dataGridView1.Columns.Add(dgvcCheckBox);

            // add some row to datagridview
            // true the checkBox Is checked
            // false the checkBox Is Not checked
            dataGridView1.Rows.Add("1","DTYUI","RTYUI",false);
            dataGridView1.Rows.Add("2", "KJHGF", "OIUY", false);
            dataGridView1.Rows.Add("3", "SDFGH", "LTDFGH", false);
            dataGridView1.Rows.Add("4", "ERJHGV", "CVHEYH", false);
            dataGridView1.Rows.Add("5", "AQSFGHKK", "TRDFHJH", false);
            dataGridView1.Rows.Add("6", "NQAAZTYI", "KITGHKG", false);
            dataGridView1.Rows.Add("7", "XBVSARY", "OTYHNC", false);
            dataGridView1.Rows.Add("8", "ACJKT", "PMLGESB", false);
            dataGridView1.Rows.Add("9", "FGHKL", "IUYTEYK", false);
            dataGridView1.Rows.Add("10", "WQAZR", "ERTYUVBD", false);
            dataGridView1.Rows.Add("11", "CKKTS", "EGCQA", false);
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            dataGridView1.AllowUserToAddRows = false;
        }

        // button delete checked row
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            for(int i = dataGridView1.Rows.Count-1; i >= 0; i--)
            {
                bool delete = (bool)dataGridView1.Rows[i].Cells[3].Value;

                // if the checkbox cell is checked

                if(delete == true)
                {
                    DataGridViewRow rowToRemove = dataGridView1.Rows[i];

                    dataGridView1.Rows.Remove(rowToRemove);
                }
            }
        }
    }
}



OutPut :
c# remove datagridview checked row
c# remove datagridview checked row

Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
NB :: Bila Sobat tertarik Ingin membuat software, membeli software, membeli source code, membeli hardware elektronika untuk kepentingan Perusahaan maupun Tugas Akhir (TA/SKRIPSI), Insyaallah Saya siap membantu, untuk Respon Cepat dapat menghubungi kami, melalui :

No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com


atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :

ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَٰلَمِين
Alhamdulilah hirobil alamin

وَ السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
wassalamualaikum warahmatullahi wabarakatuh


Artikel C# - How To Delete DataGridView Row Checked Cell In C#, Diterbitkan oleh scodeaplikasi pada Senin, 28 Maret 2016. Semoga artikel ini dapat menambah wawasan Anda. Website ini dipost dari beberapa sumber, bisa cek disini sumber, Sobat diperbolehkan mengcopy paste / menyebar luaskan artikel ini, karena segala yang dipost di public adalah milik public. Bila Sobat tertarik Ingin membuat software, membeli software, membeli source code ,Dengan Cara menghubungi saya Ke Email: Fajarudinsidik@gmail.com, atau No Hp/WA : (fajar) : 085369237896, (puat) : 085267792168.

Tawk.to