The Way to Programming
The Way to Programming
Option Strict On Public Class Form1 Private myBox as Box Private Sub Button1_MouseEnter(sender As Object, e As EventArgs) 'Handles Button1.MouseEnter myBox.mouseentermethod(sender, e) End Sub Private Sub Button1_MouseLeave(sender As Object, e As EventArgs) Handles Button1.MouseLeave Label1.Text=String.Empty End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load AddHandler Button1.MouseEnter, AddressOf Button1_MouseEnter myBox = New Box() myBox.Name = "test" myBox.mouseentermethod = AddressOf CustomMouseEnter End Sub private Sub CustomMouseEnter(sender As Object, e As EventArgs) Label1.Text = myBox.Name End Sub End Class Public Class Box delegate sub MyMouseEnter(sender As Object, e As EventArgs) Public Name As String Public Size As Double Public mouseentermethod As MyMouseEnter End Class
Sign in to your account