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的“移除”按钮样式常用设置,注意红框内的意义。

c# dataGridview的Cellclick移除事件

 

相关文章:

  • 2021-09-06
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2021-08-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-01
  • 2022-01-09
  • 2022-12-23
  • 2021-12-31
相关资源
相似解决方案