怎么让datagridview中的某一行不可编辑
生活随笔
收集整理的這篇文章主要介紹了
怎么让datagridview中的某一行不可编辑
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
可以用一個不是很“正統”的辦法:
private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == 2)
dataGridView1.ReadOnly = true;
else
dataGridView1.ReadOnly = false ;
}
這樣第二行就不可以編輯了,其它行可以。
private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == 2)
dataGridView1.ReadOnly = true;
else
dataGridView1.ReadOnly = false ;
}
這樣第二行就不可以編輯了,其它行可以。
總結
以上是生活随笔為你收集整理的怎么让datagridview中的某一行不可编辑的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C#实现字符串按多个字符采用Split方
- 下一篇: 流媒体数据代理----Anychat