Question Custom Button in usercontrol?

Mony Mony

Member
Joined
May 17, 2009
Messages
6
Programming Experience
Beginner
Hello guys. I want to make my own button on Visual Basic 2008.I followed these steps but it didn't seem to work:
1.Make a User Control
2.Add A Button and Dock.Fill to form.
Now I made some Mouse enter,leave events and I finished my button...After I place my button on the toolbar I want to add a event on my button but I cant..I can only add a event to the user control..Can someone tell me how to add an event when I press the button..]
thanks for any help...
Best Regards
Mony
 

newguy

Well-known member
Joined
Jun 30, 2008
Messages
611
Location
Denver Co, USA
Programming Experience
1-3
If you are simply making your own button, you do not need a usercontrol - just make a class that inherits from ButtonBase and you can add this to your form just like you do with other controls. You can define custom properties, and have access to all the normal events. If fact you will have a properties window for your control that even displays your custom properties.

Example:
VB.NET:
Public Class MyButton
   Inherits ButtonBase

Public Property...
 
Last edited:

newguy

Well-known member
Joined
Jun 30, 2008
Messages
611
Location
Denver Co, USA
Programming Experience
1-3
If you noticed there are categories and descriptions in the properties window, and you can define new ones with:
VB.NET:
<Category("<yourCategoryName>"), Description("<yourDescription>")> _
Public Property <something>() As Object
...
 
Top Bottom