禁止DataGridView控件中添加和删除行

实现效果:

  

知识运用:

  DataGridView控件的AllowUserToAddRows

  AllowUserDeleteRows和ReadOnly属性

实现代码:

 private void btn_no_Click(object sender, EventArgs e) { dataGridView1.AllowUserToAddRows = false; dataGridView1.AllowUserToDeleteRows = false; dataGridView1.ReadOnly = true; }

  

相关文章