So I have the following code for when the “Add player” button is clicked
private void addPlayerBtn_Click_1(object sender, EventArgs e)
{
//Do some code
}
I want to trigger this code from my SDK however. Here is what I have tried
private void command()
{
addPlayerBtn_Click_1(object sender, EventArgs e);
}
I get lots of errors as soon as I put in the line
addPlayerBtn_Click_1(object sender, EventArgs e)
Could somebody please tell me how to write the code so that I can trigger an event by just writting it in code?
For one, when calling a method, you don’t declare the type of the parameter, just the value.
So this:
Should be
Now, you’ll have to declare
senderande. These can be actual objects, if you have event args to pass, or:The above can be used in either WinForms or ASP.NET. In the case of WinForms, you can also call: