Click here to Skip to main content
15,904,951 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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)
{
}

C#
A()
{
dataGridView1_CellEndEdit(new object(),new GridViewCellEventArgs(?)) //I dont know How I Do this
}
Posted
Updated 25-May-16 4:17am
v2

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
 
Share this answer
 
Comments
mit62 6-Apr-14 0:55am    
ok,thanks.I changed the code.
Sergey Alexandrovich Kryukov 6-Apr-14 12:36pm    
It did not change the essence of the question. What are you trying to achieve?
You need to understand that you never need invoking of the events which are "not yours".
—SA
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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900