手动DataTable事件处理程序不起作用 [英] Manual DataTable Event Handler doesn't work
问题描述
你好,
i做一个事件处理程序,当行改变时调用一个函数,似乎我做错了或者仍然缺少我复制相关代码只是为了不打扰你,所以请帮助我。
DataTable TableX = new DataTable();
//填写数据所需的代码表格已经填写。
TableX.RowChanged + = new DataRowChangeEventHandler(Row_Changed);
protected void Row_Changed(对象发送者,DataRowChangeEventArgs e)
{
MessageBox.Show(" changed");
}
Hello,
i make an event handler to call a function when row changed, it seems i did something wrong or still missing and i copied the relative code only to not interrupt you, so please help me.
DataTable TableX= new DataTable();
// do required code to fill the data table and already filled.
TableX.RowChanged += new DataRowChangeEventHandler(Row_Changed);
protected void Row_Changed(object sender, DataRowChangeEventArgs e)
{
MessageBox.Show("changed");
}
推荐答案
每次在填充DataTable填充内的数据表之前移动添加事件处理程序而不是在表单加载中放置一次时修复的问题,我不知道为什么,但情况就是这样!!
the issue fixed when i moved the adding of event handler each time before filling the data table inside the DataTable fill instead of putting it once in the form load, i don't know why but this is the case!!
这篇关于手动DataTable事件处理程序不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!