调用datagridview CellEndEdit事件处理程序 [英] Calling datagridview CellEndEdit event handler

查看:105
本文介绍了调用datagridview CellEndEdit事件处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。在Datagridview中的cellEndEdit事件中我写了一些单元格计算。现在在其他一些函数中如何调用cellEndEdit事件?

hi all.In cellEndEdit event in Datagridview I wrote some cell calculating.now In some Other functions How can I call cellEndEdit event ?

<pre lang="c#">
private void dataGridView1_CellEndEdit(object sender, GridViewCellEventArgs e)
{
}




A()
{
dataGridView1_CellEndEdit(new object(),new GridViewCellEventArgs(?)) //I dont know How I Do this
}

推荐答案

没有这样的概念,召唤事件。不调用事件,但可以调用它们。不,这不仅仅是一个不同的词;这个概念本质上是不同的。



现在,你谈论的是一个你永远无法调用的事件。这是因为唯一可以调用事件的代码只能在某种方法中,该方法是声明事件类型的成员。您甚至无法在派生类中执行此操作。这是一个重要的万无一失的.NET功能。



你真的不需要它。事件的目的完全不同。如果你分享了你的最终目标,我可能会解释你需要做什么。



-SA
There is not such concept, "call an event". Events are not called, but they can be invoked. No, this is not just a different word; the concept is essentially different.

Now, you are talking about an event which you never ever will be able to invoke. This is because the only code which can invoke event can only be in some method which is a member of the type declaring the event. You cannot even do it in a derived class. This is one of the important fool-proof .NET features.

And you really never need it. The purpose of events is completely different. If you shared your ultimate goal, I could probably explain what you need to do.

—SA


为什么你不使用EndEdit方法?此方法调用CellEndEdit事件,如果您使用此方法,则可能不需要调用CellEndEdit事件。
Why you don`t used EndEdit method ? this method call CellEndEdit event and if you used this method probably yo don`t need to the call CellEndEdit event.


这篇关于调用datagridview CellEndEdit事件处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆