External Source Directive in VB.NET
Visual Basic 2010 allows code to be included in a source file from external code files. The #ExternalSource directive is used for this purpose.
External Source Directive
Visual Basic 2010 allows code to be included in a source file from external code files. The #ExternalSource directive is used for this purpose. The parameters of #ExternalSource are the path of external file, line number of the first line, and the line where the error occurred. This directive is used only by the compiler and the debugger and has no effect on compilation.
The code snippet in Listing 7 uses #ExternalSource directives to access code in an external VB class.
Imports System
Public Class ExternalSourceClass
Sub TestExternalSource()
#ExternalSource("c:\junk\VbCode.vb", 12)
Console.WriteLine("In external file. ")
#End ExternalSource
End Sub
End Class
Listing 7