Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
This topic has not yet been rated - Rate this topic

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 a Form class called Form1, and how you are now able to get a default instance of this Form class through My.Forms.

' The old method of declaration and instantiation 
Dim myForm As New Form1
myForm.show()
' 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.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft. All rights reserved.