读书人

检测form内数据变动,该如何处理

发布时间: 2012-01-19 20:57:58 作者: rapoo

检测form内,数据变动
可以一个一个判断textchanged,
有没简单一点的方法检测form内,数据变动, 包括datagridview控件

请教
谢谢

[解决办法]
Sorry, it does not work to sink to the form's Validating event.
There is a thread on http://bytes.com/groups/net-vb/362101-how-does-validation-work-winforms discussing the firing of form's Validating event, however, no conlusion was get there.

My next solution would be something like below, however, it's poor anyway, waiting for gurus...

C# code
protected override void OnLoad(EventArgs e) {            base.OnLoad(e);            foreach (Control control in Controls) {                if(control.CausesValidation) {                    control.Validating += new CancelEventHandler(control_Validating);                }            }        }        void control_Validating(object sender, CancelEventArgs e)        {            Console.WriteLine(sender);        }
[解决办法]
探讨
Sorry, it does not work to sink to the form's Validating event.
There is a thread on http://bytes.com/groups/net-vb/362101-how-does-validation-work-winforms discussing the firing of form's Validating event, however, no conlusion was get there.

My next solution would be something like below, however, it's poor anyway, waiting for gurus...

C# codeprotected override void OnLoad(EventArgs …

[解决办法]
探讨
引用:
Sorry, it does not work to sink to the form's Validating event.
There is a thread on http://bytes.com/groups/net-vb/362101-how-does-validation-work-winforms discussing the firing of form's Validating event, however, no conlusion was get there.

My next solution would be something like below, however, it's poor anyway, waiting for gurus...

C# codeprotected overr…

读书人网 >C#

热点推荐