R
Rippo
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.WriteLine("TEST1.A Called")
End Sub
End Class
Public Class test2
Public Sub a()
Console.WriteLine("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.CreateInstance(GetType(test1))
Dim BL As test1 = CType(o, test1)
Else
o = Activator.CreateInstance(GetType(test2))
Dim BL As test2 = CType(o, test2)
End If
End Sub
Sub Main()
BL.a()
Console.ReadLine()
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.WriteLine("TEST1.A Called")
End Sub
End Class
Public Class test2
Public Sub a()
Console.WriteLine("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.CreateInstance(GetType(test1))
Dim BL As test1 = CType(o, test1)
Else
o = Activator.CreateInstance(GetType(test2))
Dim BL As test2 = CType(o, test2)
End If
End Sub
Sub Main()
BL.a()
Console.ReadLine()
End Sub
End Module