R
Rich
Hello,
The following Delegates example works with Option Strict
Off, but if I change it to Option Strict On then VB.Net
complains about the line
dgY = System.Delegate.Combine(dgI, dgA)
Is there a way to use the Combine method of Delegates in
VB.Net with Option Strict On?
----------------------------------------------------------
Example:
Option Strict Off
Option Explicit On
Option Compare Binary
Public Class Form1
Inherits System.Windows.Forms.Form
+Windows Form Designer Generated Code
Delegate Sub dg()
Dim dgI, dgA, dgY As dg
Private Sub Form1_Load(...) Handles MyBase.Load
dgI = AddressOf Hi
dgA = AddressOf Bye
dgY = System.Delegate.Combine(dgI, dgA)
End Sub
Sub Hi()
MsgBox "Hi"
End Sub
Sub Bye()
MsgBox "Bye"
End Sub
Private Sub Button1_Click(...) Handles Button1.Click
dgI()
dgA()
dgY()
End Sub
End Class
The following Delegates example works with Option Strict
Off, but if I change it to Option Strict On then VB.Net
complains about the line
dgY = System.Delegate.Combine(dgI, dgA)
Is there a way to use the Combine method of Delegates in
VB.Net with Option Strict On?
----------------------------------------------------------
Example:
Option Strict Off
Option Explicit On
Option Compare Binary
Public Class Form1
Inherits System.Windows.Forms.Form
+Windows Form Designer Generated Code
Delegate Sub dg()
Dim dgI, dgA, dgY As dg
Private Sub Form1_Load(...) Handles MyBase.Load
dgI = AddressOf Hi
dgA = AddressOf Bye
dgY = System.Delegate.Combine(dgI, dgA)
End Sub
Sub Hi()
MsgBox "Hi"
End Sub
Sub Bye()
MsgBox "Bye"
End Sub
Private Sub Button1_Click(...) Handles Button1.Click
dgI()
dgA()
dgY()
End Sub
End Class