c# dataGridview的Cellclick移除事件

        private void gvMoldInfo_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 1)
                return;

            string colName = gvMoldInfo.Columns[e.ColumnIndex].Name;
            if (colName != colRemove.Name)
                return;

            clsBarcodeMold rec = gvMoldInfo.Rows[e.RowIndex].DataBoundItem as clsBarcodeMold;
            if (rec == null)
                return;

            list.Remove(rec);
            BindGridView();
        }

 

以上爲某dataGridview的cellclick的移除事件,挺好用的,下面爲dataGridview的「移除」按鈕樣式經常使用設置,注意紅框內的意義。spa

相關文章
相關標籤/搜索