Reputation: 871
I have a little problem calling the button1_click
event of form1
from my form2
.
When I call form1.button1_click()
it gives me an error saying:
Argument not specified for parameter 'e'.
How can I fix this?
Upvotes: 2
Views: 20918
Reputation: 81610
Assuming WinForms, try using this:
form1.button1_click(Nothing, Nothing)
or
form1.button1_click(form1.button1, EventArgs.Empty)
The error means the procedure you are trying to run has parameters, but you left them out in your call. The click event is looking for two parameters, sender As Object
and e As EventArgs
.
Upvotes: 3
Reputation: 11216
You may also wish to try this:
form1.button1.PerformClick()
Upvotes: 2