I am aware of DefaultEventAttribute but I am still a bit clueless of how to implement it correctly.
I have made a simple control class that inherits from NumericUpDown:
public class NumericControl : System.Windows.Forms.NumericUpDown
I want to use it in my project instead of a default NumericUpDown control, and I want to replace a default doubleclick-generated event in visual studio. By default it's:
private void numericUpDown1_ValueChanged_1(object sender, EventArgs e)
And I want it to be
private void numericUpDown1_KeyPress(object sender, KeyPressEventArgs e)
Thanks in advance.
Edit: No, no, I have seen this question already. But I just want to simply replace one event by another (and both of them are already built-in in the control). I don't want to assign it to some custom event. My issue is much simpler but I still struggled with it.
if you just add
DefaultEvent
attribute to your control class with another event name, it should work fine (rebuild projects before check after adding attribute)