Datagrid视图异常DataError事件 [英] Datagrid view exception DataError event
本文介绍了Datagrid视图异常DataError事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hi Folks,
当我更改datagrid视图单元格值并删除一些主键值时。有一个弹出窗口显示要替换此默认对话框,请处理dataError事件。。我不知道我应该在哪里处理这个错误。找不到在代码中放置try catch的地方。
请建议我在哪里放置try catch来处理数据网格视图上的这种异常
问候
Hi Folks,
When I change the datagrid view cell value and delete some primary key value. there is a popup that says "To replace this default dialog please handle the dataError Event.". I am not sure where should I handle this error. find no place to put try catch in the code.
Please suggest where should I place the try catch to handle such an exception on datagrid view
Regards
推荐答案
void InitializeComponent() {
// ... //
this.DataGridView.DataError += this.DataGridView_DataError;
}
void DataGridView_DataError(object sender, DataGridViewDataErrorEventArgs e) {
e.ThrowException = false;
}
使用此代码你将捕获错误,然后根据该错误执行。
Use this code u will capture the error then perform according to that error.
你能给我发一个代码块来理解这个问题吗?
can you send me the code block to understand the issue?
这篇关于Datagrid视图异常DataError事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文