I am trying to call a MouseUp event. I usually do this with button events wich is my first example that works fine but I have compile error for the MouseUp event like shown below.

I dont know if there perheps is a difference here that I am missing ?

button257_Click(this, EventArgs::Empty); //Works fine

radioButton6_MouseUp(this, MouseEventArgs::Empty);//Gives the below error ?

[B]'Form1::Form2::radioButton6_MouseUp' : cannot convert parameter 2 from 'System::EventArgs ^' to 'System::Windows::Forms::MouseEventArgs ^'[/B]

I think perheps will be okay as I will not pass on any parameters.


MouseEventArgs::Empty is of type System::EventArgs^ so you must use a dynamic_cast<MouseEventArgs^>(MouseEventArgs::Empty) to get it into the right form. However, with sending in an empty eventargs you won't have any information to provide to your MouseUp event. Perhaps there is some other way to evoke this, like having a private member method that you call from both the event handler and in lieu of calling radioButton6_MouseUp .

Also, on the first one you should use button257->PerformClick() instead of button257_Click .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.