Hi
I have the following console application and am attempting to late bind
a class with option strict on! However of course I cant and I get the
following error "Option Strict On disallows late binding" at the line
BL.a() in method Main
How do I overcome this?
Public Class test1
Public Sub a()
Console.WriteLi ne("TEST1.A Called")
End Sub
End Class
Public Class test2
Public Sub a()
Console.WriteLi ne("TEST2.A Called")
End Sub
End Class
Module Module1
Dim BL As Object
Sub New()
Dim o As Object
If 1 = 1 Then
o = Activator.Creat eInstance(GetTy pe(test1))
Dim BL As test1 = CType(o, test1)
Else
o = Activator.Creat eInstance(GetTy pe(test2))
Dim BL As test2 = CType(o, test2)
End If
End Sub
Sub Main()
BL.a()
Console.ReadLin e()
End Sub
End Module
I have the following console application and am attempting to late bind
a class with option strict on! However of course I cant and I get the
following error "Option Strict On disallows late binding" at the line
BL.a() in method Main
How do I overcome this?
Public Class test1
Public Sub a()
Console.WriteLi ne("TEST1.A Called")
End Sub
End Class
Public Class test2
Public Sub a()
Console.WriteLi ne("TEST2.A Called")
End Sub
End Class
Module Module1
Dim BL As Object
Sub New()
Dim o As Object
If 1 = 1 Then
o = Activator.Creat eInstance(GetTy pe(test1))
Dim BL As test1 = CType(o, test1)
Else
o = Activator.Creat eInstance(GetTy pe(test2))
Dim BL As test2 = CType(o, test2)
End If
End Sub
Sub Main()
BL.a()
Console.ReadLin e()
End Sub
End Module
Comment