Chapter 13. The 'My' ReferenceThe My Namespace feature is one of many productivity enhancements introduced with Visual Basic 2005 that bring additional ease of use to .NET. It collects many of the commonly used features of the existing Framework Class Library and bundles them into an ordered hierarchy, simplifying the syntax of those features where possible. More than just a quick lookup or a list of shortcuts, My takes many complex Framework classes and simplifies them for VB programmers. This chapter includes a reference entry for each member of the My Namespace hierarchy. Each entry includes the following descriptive components:
The My Namespace feature includes many hierarchy branches. Some branches, and also some members within each branch, are only available for use in certain types of applications. For instance, the My.Response object is only available in ASP.NET applications. Other members provide different types of functionality, depending on the project type. All of these limitations are discussed within each entry. Some entries are only valid in Windows Forms applications, specifically those Windows forms applications that have the "application framework" enabled. This feature, introduced in Visual Basic 2005, provides a simplified method of starting up and ending Windows Forms applications, at least from the point of view of the source code. These features are enabled through the project's Application Properties panel. To access the project's properties, select the Properties command in Visual Studio's Project menu or double-click on the My Project entry in Visual Studio's Solution Explorer. On this panel, use the Enable application framework field to toggle the use of this feature. Some members within the My hierarchy are more commonly used than others. Some of the less commonly used features are hidden from Visual Studio's IntelliSense feature by default. To view these entries, select the All tab from the IntelliSense listing that appears while typing the entry's parent in your source code. Some features within the My hierarchy may be limited for use by the current set of security permissions in effect for the active user, application, or thread of execution. Permissions are found in the System.Security.Permissions namespace. See Appendix B for a hierarchical listing of all entries discussed in this chapter. |