question

JeffinAtl-3170 avatar image
0 Votes"
JeffinAtl-3170 asked APoblacion answered

How to trigger mouseclick event with event argument?

I have a some logic in the dataGridView1_MouseClick() event.
This event is triggered automatically when mouse is clicked on the dataGridView1.
However I need to have that event is triggered when I do something and have to highlight selected event and perform the logic in the dataGridView1_MouseClick() event.
How could I do this?

dotnet-csharp
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

APoblacion avatar image
1 Vote"
APoblacion answered

Refactor the code. Extract the content of the dataGridView1_MouseClick() into a separate method, and call the method from dataGridView1_MouseClick().
Then, find the part of the code that you described as "when I do something", and simply call from there the same method that you extracted from dataGridView1_MouseClick().

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.