|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
Default Object Instances Provided by My.Forms and My.WebServices
The My.Forms and My.WebServices objects provide access to forms, data sources, and XML Web services used by your application. They do this by providing collections of default instances of each of these objects.
A default instance is an instance of the class that is provided by the runtime and does not need to be declared and instantiated using the Dim and New statements. The following example demonstrates how you might have declared and instantiated an instance of aclass called Form1, and how you are now able to get a default instance of this Form class through My.Forms.
' With My.Forms, you can directly call methods on the default ' instance() My.Forms.Form1.Show()
The My.Forms object returns a collection of default instances for every Form class that exists in your project. Similarly, My.WebServices provides a default instance of the proxy class for every Web service that you have created a reference to in your application.