Click here to Skip to main content
15,922,584 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai...

Can i call Datagridview_Celldoubleclick event from datagridview_Keypress Event?.When i press enter button ,i have to execute the cell double click event because in that event i am using DataGridViewCellEventArgs,but in keypress event we can not use this argument.Is there any other way to do this? Please help me...


With Thanks
Sujith
Posted
Updated 18-Feb-11 18:58pm
v2

1 solution

Yes you can call another event handler from another event. You just have to create necessary parameters.

However I suggest that you take the actual code to separate method so coding would be easier and much clearer. Something like:

void datagridview_Keypress(...) {
   MyMethod(...);
}

void Datagridview_Celldoubleclick(...) {
   SomeOtherMethod(...);
   MyMethod(...);
}

void MyMethod(...) {
   ... actual code ...
}
void SomeOtherMethod(...) {
   ... actual code ...
}
 
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