G
G. Seshadri
In .NET programming I noticed that if I make a file called Box1.vb with the
following code:
Imports System
Class Box1
Shared Sub Main()
End Sub
Function test (ByVal num As Integer) As Integer
Return num*2
End Function
End Class
then I can't take advantage of it in any other file. For example, If I made
another class called Box2.vb and put it in the same directory and typed in
the following code, the compiler would give me an error:
Imports System
Class Box2
Shared Sub Main()
Dim b1 As New Box1
Console.WriteLine(b1.test(4))
End Sub
End Class
What do I need to do so that Box2 recognizes the class Box1?
P.S.
However, if I put the code of Box2.vb inside Box1.vb and deleted Box2.vb
altogether, then it would compile successfully. However, I would need to
call the file Box2.vb, not Box1.vb, since Box2.vb's main function is going
to be executed.
following code:
Imports System
Class Box1
Shared Sub Main()
End Sub
Function test (ByVal num As Integer) As Integer
Return num*2
End Function
End Class
then I can't take advantage of it in any other file. For example, If I made
another class called Box2.vb and put it in the same directory and typed in
the following code, the compiler would give me an error:
Imports System
Class Box2
Shared Sub Main()
Dim b1 As New Box1
Console.WriteLine(b1.test(4))
End Sub
End Class
What do I need to do so that Box2 recognizes the class Box1?
P.S.
However, if I put the code of Box2.vb inside Box1.vb and deleted Box2.vb
altogether, then it would compile successfully. However, I would need to
call the file Box2.vb, not Box1.vb, since Box2.vb's main function is going
to be executed.