14.3. A Namespace Overview

In this section you will get a flavor for the extent of the functionality available via the My namespace. As it is not possible to go through all the classes, methods, and overall functionality available, it is recommended that you use this as a starting point from which to explore further.

14.3.1. My.Application

The My.Application object gives you immediate access to various pieces of information about the application. At the lowest level, My.Application enables you to write to the application log through the subordinate My.Application.Log, as well as to add general information common to all Windows-based projects to the My.Application.Info object.

As mentioned earlier, if the context of My.Application is a Windows service, it also includes information related to the command-line arguments and the method of deployment. Windows Forms applications have all this information in the contextual form My.Application and enable the accessing of various forms-related data.

Prior to My, all of this information was accessible through a variety of methods, but it was difficult to determine where some of the information was. Now the information is all consolidated into one easy-to-use location. To demonstrate the kind of data you can access through My.Application, try the following sample task:

  1. Start Visual Studio 2008 and create a Visual Basic Windows application. Add a button to the form. You'll use the button to display information about the application.

  2. Double-click ...

Get Professional Visual Studio® 2008 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.