处理程序堆栈溢出?!?! [英] Handler Stack Overflow?!?!
问题描述
请帮忙!
我在一个类中有一个处理程序,可以处理表格中的列是否被修改为
,因此:
dtWhatif = dsOp.Tables(" whatif")
AddHandler dtWhatif.ColumnChanged,New
DataColumnChangeEventHandler(AddressOf Whatif_Changed)
测试时,我收到一个错误:类型未处理的异常
'System.dll中出现'System.StackOverflowException''
>
所以我放入一个调试语句来查看堆栈溢出的原因。这个
处理程序被称为4082次!我所做的只是更改数据网格的一个
单元格中的值!
为什么?!为什么?!
Tom
Please help!
I have a handler in a class that handles when a column in a table is
modified, as such:
dtWhatif = dsOp.Tables("whatif")
AddHandler dtWhatif.ColumnChanged, New
DataColumnChangeEventHandler(AddressOf Whatif_Changed)
When testing this, I got an error: An unhandled exception of type
''System.StackOverflowException'' occurred in system.dll
So I put a debug statement in to see why the stack is overflowing. This
handler was called 4082 times! All I did was change the value in one
cell of a datagrid!
Why?! Why?!
Tom
推荐答案
> dtWhatif = dsOp.Tables(" whatif")
> dtWhatif = dsOp.Tables("whatif")
AddHandler dtWhatif.ColumnChanged,New
DataColumnChangeEventHandler(AddressOf Whatif_Changed)
AddHandler dtWhatif.ColumnChanged, New
DataColumnChangeEventHandler(AddressOf Whatif_Changed)
在Whatif_Changed中会发生什么?
What happens in Whatif_Changed?
现在,它只是调用并清空函数。我只是测试了
处理程序,发现它没有按预期工作。
Tom
Chris Dunaway写道:
Right now, it just calls and empty function. I was just testing the
handler, and found it doesn''t work as expected.
Tom
Chris Dunaway wrote:
dtWhatif = dsOp.Tables(" whatif")
AddHandler dtWhatif.ColumnChanged,New
DataColumnChangeEventHandler(AddressOf Whatif_Changed)
dtWhatif = dsOp.Tables("whatif")
AddHandler dtWhatif.ColumnChanged, New
DataColumnChangeEventHandler(AddressOf Whatif_Changed)
Whatif_Changed会发生什么?
What happens in Whatif_Changed?
I刚尝试在事件处理程序中注释掉对其他函数的调用。你猜怎么着?没问题。如果处理程序调用另一个函数,我只得到堆栈
重载。这不是一个好的
的事情,因为我需要能够在
列发生变化时调用多个函数。有什么建议吗?
Tom
Chris Dunaway写道:
I just tried commenting out the call to the other function from within
the event handler. Guess what? No problem. I only get the stack
overload if the handler calls another function. This is not a good
thing, because I need to be able to call several functions when the
column has changed. Any suggestions?
Tom
Chris Dunaway wrote:
dtWhatif = dsOp.Tables(" whatif")
AddHandler dtWhatif.ColumnChanged,New
DataColumnChangeEventHandler(AddressOf Whatif_Changed)
dtWhatif = dsOp.Tables("whatif")
AddHandler dtWhatif.ColumnChanged, New
DataColumnChangeEventHandler(AddressOf Whatif_Changed)
会发生什么在Whatif_Changed?
What happens in Whatif_Changed?
这篇关于处理程序堆栈溢出?!?!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!