Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set the default event to be edited for my custom control in Visual Studio?

I made a custom button by inheriting the Button class. When I double click the custom button in Designer, it makes the event handling function for MyButton.Click:

Private Sub MyButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyButton1.Click

    End Sub

How can I make it so that when you double click, it makes the event handling function for another event? For example, MyButton.KeyUp:

Private Sub MyButton1_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyButton1.KeyUp

    End Sub

Hopefully, someone can help me with this.

like image 743
Arjan Avatar asked Dec 02 '22 04:12

Arjan


1 Answers

use DefaultEventAttribute:

<DefaultEvent("KeyUp")> Public Class MyButton
like image 172
max Avatar answered Dec 18 '22 21:12

max