选择ultragrid一行进行删除时,该控件会自动弹出一个对话框,问是否删除,我不想用这个,我要用自己定义的,要怎么把自带的对话框禁用掉?
try
{
if (MessageBox.Show("正在删除您选中的一条记录,是否要删除?", "删除记录", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
{
int i = rowindex;
string id = this.ugrid_edu.Rows[i].Cells[0].Text;
this.ugrid_edu.Rows[i].Delete();
this.oleConnection.Open();
this.oleDbDataAdapter1.DeleteCommand.CommandText = "delete from t_edu where id=@id";
this.oleDbDataAdapter1.DeleteCommand.Parameters["@id"].Value = Convert.ToInt32(id.ToString());
this.oleDbDataAdapter1.DeleteCommand.CommandType = CommandType.Text;
this.oleDbDataAdapter1.DeleteCommand.ExecuteNonQuery();
MessageBox.Show("ok", "ok", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception err)
{ MessageBox.Show(err.Message.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
this.oleConnection.Close();
}
try
{
if (MessageBox.Show("正在删除您选中的一条记录,是否要删除?", "删除记录", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
{
int i = rowindex;
string id = this.ugrid_edu.Rows[i].Cells[0].Text;
this.ugrid_edu.Rows[i].Delete();
this.oleConnection.Open();
this.oleDbDataAdapter1.DeleteCommand.CommandText = "delete from t_edu where id=@id";
this.oleDbDataAdapter1.DeleteCommand.Parameters["@id"].Value = Convert.ToInt32(id.ToString());
this.oleDbDataAdapter1.DeleteCommand.CommandType = CommandType.Text;
this.oleDbDataAdapter1.DeleteCommand.ExecuteNonQuery();
MessageBox.Show("ok", "ok", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception err)
{ MessageBox.Show(err.Message.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
this.oleConnection.Close();
}
解决方案 »
- datagridview怎么在现有内容后面添加一行
- c# winform简单问题。如何获取指定y坐标所有控件。
- ConnectionOptions远程关机时用户空密码异常
- 求助大虾,下拉框触发事件出问题,!!!
- WinForm DataGrid 中的 DataGridBoolColumn 求助。
- 为什么 RowState是 DataRowState.Modified 却没有更新?
- httplistener异步的一个小问题
- 指向图片的指针如何转化为图片(该指针从身份证读卡器读出图片的信息)
- C # 保存文件和读取文件的问题
- 快速开发分布式系统!顶呀!
- Nhibernate代码生成器修订版
- WINFROM怎么取路径。
把
this.ugrid_edu.Rows[i].Delete();
改为
this.ugrid_edu.Rows[i].Delete(false);
就ok了
改为this.ugrid_edu.Rows[i].Delete(false);