Your Introduction to the My Object in VS 2005

VB can be a completely object-oriented language and still find ways to enhance productivity. One of the ways that Microsoft is still finding innovative ways to increase productivity without making VB.NET a second-class language is the introduction of the My object, which will ship in VS 2005 and is available in Beta 1 versions of VB 2005. This article introduces this new object.

Classes in My Object

My is an object like Me, but instead of being a self-referencing object it is a wrapper that makes getting at the advanced features of .NET easier. If you found using advanced features such as the ResourceManager and WebServices confusing, or even reading information from the AssemblyInfo file, then you are going to love My.

Note: The actual nomenclature for My is still being decided. Currently, the correct word to describe My is feature. It remains to be seen whether Microsoft will call My an object, namespace, or something else when it releases VS 2005.

My contains Application, Computer, Resources, User, and WebServices wrapper objects that act like shortcuts to powerful and useful features of .NET. You can use these features without creating instances of the classes they wrap and without mastering arcane subjects like reflection first. Don't misunderstand me: One should learn reflection because it is a powerful tool, but lowering the barrier to entry is a classic VB response to complex subjects.

Setting AssemblyInfo Information

Rather than try to cover everything My offers, I picked just one facet, the AssemblyInfo class, as a vessel for introducing this neat feature. The AssemblyInfo class is a wrapper for the AssemblyInfo.vb file that VB 2005 adds to every project. The AssemblyInfo class makes it easy to obtain information about your project, such as title, copyright, and version information. A classic use for this information is to create an About dialog for your Windows Forms applications.

Early versions of VB.NET used assembly-level attributes and code to incorporate things like version information into VB assemblies. In the new version, Microsoft created an easy-to-use dialog box (see Figure 1) that permits you to add assembly information to your .NET applications. You set this information by selecting Project|Properties from the menu. This opens your project properties dialog. In that dialog, select the Application tab and click the Assembly Information button. Simply fill out the dialog and click OK.

Figure 1: Add Assembly Information Using This Dialog Form

Reading My.Application.AssemblyInfo

Reading the assembly information has always been easier in VB than in C# because the Microsoft.VisualBasic.dll assembly is always part of your VB applications. In current editions of VB, you have to create an AssemblyInfo object, passing the executing assembly as a parameter. In VB 2005, all you have to do is access the ubiquitous My object, referring to My.Application.AssemblyInfo, and you have immediate, one-line access to your assembly's information (see Listing 1).

Listing 1: Access Information About an Assembly with a Single Line of Code

Module Module1

   Sub Main()
   End Sub

End Module

Ease of use is what VB always has been about. By building the new VB on top of the powerful .NET framework, VB can be both easy to use and powerful.

New VB 2005 Feature

The My object encapsulates many of the advanced features of .NET into a consolidated wrapper package that makes these features easier to access—often with a single line of code. Pick up a beta copy of VS 2005 today and you will discover My and many other new features that increase your productivity and enjoyment.

About the Author

Paul Kimmel is the VB Today columnist for and has written several books on object-oriented programming and .NET. Check out his book Visual Basic .NET Power Coding from Addison-Wesley and his upcoming book UML DeMystified from McGraw-Hill/Osborne (Spring 2005). Paul is also the founder and chief architect for Software Conceptions, Inc, founded 1990. He is available to help design and build software worldwide. You may contact him for consulting opportunities or technology questions at

If you are interested in joining, sponsoring a meeting, or posting a job, check out, the Web page of the Greater Lansing area Users Group for .NET.

Copyright © 2005 by Paul Kimmel. All Rights Reserved.


  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Finance leaders have been talking about expanding the value-added role of their teams for a long time. The debate is no longer whether the finance and accounting function needs to become a more strategic partner to the rest of the business but rather how to get there. Technology innovation has caught up to this ambition, and what was once aspiration can be a reality – and the choice is now yours. Read this research report to learn how to make the most of information tools to enable innovation and growth.

  • On-demand Event Event Date: March 19, 2015 The 2015 Enterprise Mobile Application Survey asked 250 mobility professionals what their biggest mobile challenges are, how many employees they are equipping with mobile apps, and their methods for driving value with mobility. Join Dan Woods, Editor and CTO of CITO Research, and Alan Murray, SVP of Products at Apperian, as they break down the results of this survey and discuss how enterprises are using mobile application management and private app stores to …

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date