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
 
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    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