ARTICLE

External Source Directive in VB.NET

Posted by Mahesh Chand Articles | Visual Basic Language May 09, 2010
Visual Basic 2010 allows code to be included in a source file from external code files. The #ExternalSource directive is used for this purpose.
 
Reader Level:

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.





share this article :
post comment
 
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor