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
Summary
Programming Windows Forms using Visual Basic 2010 is a programming guide for Windows Forms developers using Visual Basic 2010 and Visual Studio 2010. This is an ongoing series. In this part, we learned about the Run and Exit methods of the Application class and how they are used in an application.
Programming Windows Forms using Visual Basic 2010
Here are previous articles related to this series.