sydneyguy
asked on
C# private void btnConnect_Click(object sender, EventArgs e) calling a button generated function
I have a function that is run off a button on the form but wish to call it from another normal function were i do not have the mouse pos set up for the event e
private void btnConnect_Click(object sender, EventArgs e)
i can use
btnConnect_Click("contact" , EventArgs e)
its looking for {X = 33 Y = 10 Button = Left} System.EventArgs System.Windows.Forms.Mouse EventArgs}
but not sure how to recreate the EventArgs e varable that the function wants
Argument '2': cannot convert from 'string' to 'System.EventArgs'
private void btnConnect_Click(object sender, EventArgs e)
i can use
btnConnect_Click("contact"
its looking for {X = 33 Y = 10 Button = Left} System.EventArgs System.Windows.Forms.Mouse
but not sure how to recreate the EventArgs e varable that the function wants
Argument '2': cannot convert from 'string' to 'System.EventArgs'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ASKER
I oftern run into this prop and woudl really like to get the artificial call going so that i do not have to re write code when an artificial call will do the perfect job
Did you see my comment back here?
https://www.experts-exchange.com/questions/27308500/C-private-void-btnConnect-Click-object-sender-EventArgs-e-calling-a-button-generated-function.html#36538885
Just use the PerformClick() method of the Button you want to click...
https://www.experts-exchange.com/questions/27308500/C-private-void-btnConnect-Click-object-sender-EventArgs-e-calling-a-button-generated-function.html#36538885
Just use the PerformClick() method of the Button you want to click...
I suggested on how you could create EventArgs and MouseEventArgs. You cannot use the lines as is.
I agree with Idle_mind that you are better off using PerformClick() method of the button.
I agree with Idle_mind that you are better off using PerformClick() method of the button.
ASKER
thanks every one looking at your response i have used a variation on all three inputs, so awarded the points as such thanks for your help
new EventArgs();
new MouseEventArgs() { Button=MouseButtons.Left,L