Home > Microsoft .Net Development News > Visual Basic 2005 programming: Ten tips and time-savers
Microsoft .Net Development News:
EMAIL THIS

Visual Basic 2005 programming: Ten tips and time-savers

By Brian Eastwood, Associate Editor
23 Jun 2006 | SearchVB.com

Office Development Channel
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google

Visual Basic 2005 may be the latest incarnation of the 15-year-old programming language, but an ongoing survey of SearchVB.com readers indicates that more developers are still coding in VB 6 that in VB.NET. On top of that, Visual Basic 9, code-named Orcas, is due for release at the end of 2007. Each new release brings productivity enhancements but also questions about performance and migration.

At Tech Ed 2006, SearchVB.com attended several breakout sessions focused on Visual Basic 2005. This three-part series looks at the language's past, present and future.


.

Visual Basic 2005 introduces a plethora of new programming features -- an improved IDE, reusable code snippets, the My namespace and so on. Kit George, a program manager for Microsoft's VB team, demonstrated a variety of these time-saving improvements in a Visual Basic 2005 tutorial at Tech Ed 2006.

In no particular order, here are 10 of the tips George presented.

  • Generics. The Generics class in .NET 2.0 gives developers the flexibility to write methods once and let the .NET Framework handle type issues. There is no boxing of objects or casting of exceptions, which improves performance, and compile errors show up earlier in the coding process. "The primary objective is not performance. The primary objective is to help the consumers write their code more easily and discover problems earlier," George said.

  • Debugger ToolTips. Debugging in Visual Basic 2003 was "pretty vanilla," as developers had to go to the Watch window to find it and it didn't say much. In VB 2005, users can expand the box, to see the properties of a particular type, or hold down Ctrl to male the box transparent, George said.

  • Edit and Continue. Speaking of debugging, this feature lets developers edit code while they're debugging it. "You don't have to keep stop-starting all the time. That can be a very laborious process," George said, and VB veterans concurred.

  • The My namespace. Along with giving developers a place to find and store "the stuff you're going to do 90% of the time," George said the My namespace lets developers do things like retrieve information with a single line of code -- My.Computer.FileSystem.ReadAllText(filename.txt) -- and add code from another file through a partial class. (Read more about this topic in Visual Basic 2005 'My' Space set to help developer and Customizing the My Namespace.)
    More VB 2005 resources

    Mini-Guide to Visual Basic 6 and VB.NET

    Visual Basic 2005 Learning Guide

    Where to start with Visual Basic 2005

  • Templates. These are stored as zip files containing an XML file, a VB file set to transport, a designer file and all other files related to the template. To add a template, just go to "Add New Item" and the appropriate file from the template will appear there.

  • Snap lines. This graphical form-building tool, likely familiar to designers, gives developers granular control, such as alignment to the top left of a form or to existing controls.

  • Application settings. With this feature, a developer can name a pointer variable, indicating the location of a stored form. Thus the values of a property, set up once, can be used in many places.

  • Renaming. By right-clicking on a code identifier like a class name, field or type, a developer can rename it and update all calls and references to that identifier.

  • Refactoring. This functionality is not available from Microsoft, but third-party vendors like Developer Express, Know DOT NET and JetBrains have filled the void nicely. George showed the many benefits of refactoring, such as encapsulating private fields, graphically reordering parameters and saving oft-repeated code as a method. (Read more on refactoring in Revisiting VB refactoring again.

  • Snippets. Visual Basic 2005 comes with 500 pre-installed code snippets, categorized by task. They are accessible by right-clicking, by the keyboard shortcut "Tab+?" or by typing the individual snippet's shortcut. Developers can also create snippets for the custom code they use regularly.

    Go on to Part 3 of the series, What to expect from Vista development, VB 9
    Go back to Part 1 of the series, Can VB 6 and VB.NET forms coexist?


    Tags: .NET Framework 2.0 and Visual Studio 2005 developmentVIEW ALL TAGS

    Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



    RELATED CONTENT
    .NET Framework 2.0 and Visual Studio 2005 development
    Mono 2.0 moves .NET apps to Linux - includes migration analyzer
    Using the Visual Studio 2005 DataSet Designer to build a data access layer
    SCM Visual Studio plug-in offers updated interface
    Assembly versioning in the .NET Framework 2.0
    SearchVB.com's Podcast Page
    Visual Studio 2008 Learning Guide: Multi-targeting
    On managing a .NET Framework 1.x migration
    Case Study: IdeaBlade DevForce object mapping
    Book excerpt: Printing in Visual Basic 2005
    CodeGear RAD Studio now supports .NET 2.0

    RELATED GLOSSARY TERMS
    Terms from Whatis.com − the technology online dictionary
    IronRuby  (SearchWinDevelopment.com)

    RELATED RESOURCES
    2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
    Search Bitpipe.com for the latest white papers and business webcasts
    Whatis.com, the online computer dictionary



  • Development Solutions - Silverlight, WinForms, ASP.NET
    About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
    SEARCH 
    TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

    TechTarget Corporate Web Site  |  Media Kits  |  Site Map




    All Rights Reserved, Copyright 2000 - 2009, TechTarget | Read our Privacy Policy
      TechTarget - The IT Media ROI Experts