c#下判断datagridview是否选中的语句

来源:互联网 发布:php arraypush 用法 编辑:程序博客网 时间:2024/06/10 22:07

 if (this.dataGridView1.Rows.Count < 2)
            {
                MessageBox.Show("禁止空删除!");
                return;
            }

    if (this.dataGridView1.CurrentCell == null)
            {
               
                MessageBox.Show("请选择信息后后再删除!");
                return;
            }           
  if (this.dataGridView1.CurrentRow.Index == -1)

            {

                MessageBox.Show("请选择信息后后再删除!");
                return;

            }

原创粉丝点击