积极答复者
如何设置或取消datagridview为编辑状态

问题
答案
-
不要取消“允许编辑”,然后
DataGridView1.EditMode = DataGridViewEditMode.EditProgrammatically;
DataGridView1.BeginEdit(True);
周雪峰- 已标记为答案 YiChun Chen 2009年8月19日 3:30
-
你好,
干脆在Design时设为Readonly,在runtime时取消就可以实现你的需要。我没有看到那个属性可以设置Enable Edit。
Best regards,
Riquel
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- 已标记为答案 makefor123 2009年8月20日 8:20
全部回复
-
private void dataGridView1_CellValidated(object sender, DataGridViewCellEventArgs e)
{
try
{
if (int.Parse(this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()) > 12)
{
this.dataGridView1.CancelEdit();
}
}
catch (Exception ex)
{
this.dataGridView1.CancelEdit();
MessageBox.Show(ex.Message);
}
}
jon.valett@gmail.com -
不要取消“允许编辑”,然后
DataGridView1.EditMode = DataGridViewEditMode.EditProgrammatically;
DataGridView1.BeginEdit(True);
周雪峰- 已标记为答案 YiChun Chen 2009年8月19日 3:30
-
你好,
干脆在Design时设为Readonly,在runtime时取消就可以实现你的需要。我没有看到那个属性可以设置Enable Edit。
Best regards,
Riquel
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- 已标记为答案 makefor123 2009年8月20日 8:20