委拖的一些小应用
Public Class Form2
Public Delegate Sub CallBackManager(ByVal name As String)
Dim mdlgcall As CallBackManager
Public Sub rega(ByVal abc As CallBackManager)
mdlgcall = abc
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
mdlgcall("aaaa")
End Sub
End Class
Public Class Form1
Private Sub Test(ByVal str As String)
Me.Label1.Text = str
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim form2 As New Form2
Dim CallMan As New Form2.CallBackManager(AddressOf Test)
form2.rega(CallMan)
form2.ShowDialog()
End Sub
End Class
Me.Label1.Text = str
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim form2 As New Form2
Dim CallMan As New Form2.CallBackManager(AddressOf Test)
form2.rega(CallMan)
form2.ShowDialog()
End Sub
End Class