Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
  Report: Visual Basic World Tour (Whidbey)  
 
 

On April 26, 2004, I attended Microsoft's "Visual Basic World Tour" presentation in Denver. Overall it was worth attending and you should probably try to go when it comes to your area. I encourage you to learn more. Find out where and when the tour will be in your area, and register for the event. Register early because the Denver one filled up our usual meeting place, was moved to a bigger room at a hotel, and was still over filled. If you don't get registered, however, show up early and they'll probably let you in.

The first half of the meeting was about the Power Pack, VB Resource Kit, VS .NET Tools for Office, and tablet PCs. The speaker was okay but few of us wanted to hear about any of that. We wanted the Whidbey preview (now officially named Visual Studio 2005 so you can guess when they expect to release it, although that doesn't mean it won't be December ;-).

They gave each attendee:

  • Visual Studio 2005 Community Technology Preview, March 2004 build. This is more recent than the one you got at PDC but it's still very flaky.
  • A VB Resource Kit containing white papers, controls, How To's, etc.
  • An ASP .NET Resource kit containing something (they didn't say what and I haven't looked at mine).
  • A tee-shirt. Yeehaw!
  • A chance to win one of two pocket PCs. (I didn't win :-(

Good resources:

In the first half of the talk:

  • The Power Pack will ship around June with the source code! You'll be able to see VB .NET code that Microsoft used to implement various useful controls. (And use the controls, too, of course.)
  • Power Pack controls include:
    • Utility Toolbar: Makes it easy to create toolbar buttons for all the standard stuff: open, close, new, and lots more.
    • Task Pane: Lets the user rollup and hide pieces of the application that he doesn't need at the moment.
    • Notification Window: An annoying popup that appears in the lower right corner of the screen to tell you something (as in "you've got mail" or "you're fired") and then goes away.
    • File Viewer: provides Windows Explorer-like displays of the file system. We didn't get much detail on that one or the other controls in the pack.
  • An InkEdit control lets tablet PC users scribble writing and the control turns it into text. It was pretty slow and made a mistake the first time the presenter tried script writing but I guess it's cool if you're a tablet PC person. The control save save "ink" in a GIF with the ink data in GIF comments so later you can view it in any graphical viewer that reads GIFs or you can load it back into an ink control.
  • The next version of Office will use the .NET framework included in the next version of Windows (Longhorn).
  • Direct quote: Office will continue to support VBA. I interpret this to mean that .NET will invade the Office applications but that they will continue using VBA as their macro language (of course, some like Access also have their own flavor of language) for at least the next few versions. I suspect VBA will be around for a long time.
  • VS 2005 will have a more robust VB6 upgrade Wizard. It will contain a few new features but several in the audience were just hoping it would crash less with no explanation.
  • There is apparently an add-in that converts VB6 code snippets to VB .NET, as opposed to converting applications.
  • There are plans for better DirectX integration in VS 2005. A better media player may happen more in the Longhorn time frame.
  • Aside: The Windows XP 1 disk is the same disk you use to install a tablet OS. At install time, it detects the hardware and makes appropriate choices.
  • Microsoft is trying to improve the MSDN search. They know that the current system sucks and more people probably use Google to search MSDN than use the MSDN search engine.
  • They're trying to set up a bug tracking database where we can report bugs (instead of paying Microsoft support to report their bugs). We'll see if that happens.
  • There will be small changes to GDI+ in VS 2005. Bigger changes may happen around Longhorn.

In the second half...

...they moved to Whidbey demos. Most of the changes are "convenience" features added to make developing applications easier. I'm always suspicious of such things because they tend to amount to "we don't have anything really important to give you but we want to sell you a new version."

Some of the new features really are useful, however, and will make your lives easier. There are also a few more fundamental additions to the framework. Here are some highlights:

  • The IDE is faster. The presenter was using a 1.7 GHz processor and it was hard to tell how this would benchmark against a typical system but I suspect there really are speed improvements. I also suspect that Microsoft is still following the great tradition of giving *their* developers machines of god-like power with huge monitors so they never fully understand the average developer's situation, but at least there seems to be progress.
  • Related: The first presenter mentioned that he had originally built his demo in a much larger screen than the one used in the presentation, which was only 1024x768. How many of us can work on a screen that is a lot bigger than 1024x768?
  • Also related: An audience member asked about the clutter: with all the windows, viewers, toolbars, toolboxes, and whatnot, there's hardly room to design the application. They didn't have a great answer for this, although VS 2005 will have a greatly simplified basic interface. In particular, they are trying very hard to keep all the tools on a single toolbar rather than cluttering up the desktop with six levels of toolbars. They have also simplified the menus.
  • Aside: I noticed that the Toolbox now has a rollup feature that shrinks it to the left when you're not using it. When it is expanded, however, it covers the left part of the form designer. That's a bit of a problem because the form sits in the upper left corner of the designer. So the strategy the presenters followed was: (1) open toolbox. (2) click thumbtack to lock it down. That makes the form designer scoot over so it's not covered. (3) place the control. (4) unclick the thumbtack to release the toolbox and hide it. Yuck! It would be a big break from tradition, but it would make more sense to move the toolbox to the right side of the form designer area so it doesn't cover the form every time you open it. You can do that by simply dragging the toolbox to the right position but that's not what they were doing.
  • When you start a new project, you no longer need to pick a directory right away. It's more like in VB 6. You only need to pick a directory when you save. The presenter called this a "zero-impact project."
  • When you start a new project, you can select a template of your own devising. The templates are zip files containing an XML manifest that describes the template. Supposedly you can easily copy one of these and modify the XML file to make your own.
  • (If I understood correctly) There is a hook to import new templates. That means you can go to Microsoft's Web site and download new templates. Perhaps this will make sharing templates among developers easier, too?
  • The Solution Explorer will be simpler. This is part of a bigger topic.
VS 2005 takes a "if you won't definitely need it, I'll hide it" approach. You can dig through the configuration and options to find this stuff but it is hidden by default. For example, resource files and references are hidden in the Solution Explorer unless you click the Show All Files button.

Similarly, VS 2005 has removed the Designer Generated Code section from forms and placed it in a separate hidden file (named, for example, Form1.Designer.vb). This is possible because of a new "partial" class syntax. This lets you define parts of a single class in several different files. They break the form's class into two files: one with the code you write and one with the Designer generated code.

There has been some argument about whether this is a good idea. Some (including me) feel this has the potential to scatter a class's information and it defeats one of the most important benefits of object-oriented programming: the fact that a class encapsulates all of its relevant information in one place. It raises the potential for serious confusion.

One specific instance of this that may cause problems is that the hidden part of the form includes its Inherits statement so it's not obvious from the file that you will look at most what the form's parent class is. This isn't a big deal for a simple form but could be trouble for other classes.

Personally, I will probably use Regions rather than splitting a class up. The presenters said that they use this feature "all over the place" so I suspect this is one of the cases where Microsoft will listen closely to our concerns but the decision is already made.


Cool quote when faced with a glitch in the demo:

If it were ready, we would have shipped already.
  • When you position controls, snap lines appear that help you line up the controls' edges. Personally, I like the grid. For example, it lets me easily space buttons a specific distance apart. The new version lets you do that, too, but the grid isn't visible (at least by default) so it's hard to count longer distances.
  • Edit and continue is back!
  • VS 2005 has global name replace. If you change the name of a form, variable, etc. the IDE changes all references to that item. For example, if you change the file Form1.vb to ServiceReport.vb, the IDE makes the changes everywhere the project references Form1. There are limits to this. For example, suppose if you make a button named Button1, give it an event handler, and then change the button's name to btnGo. The IDE changes references to the button but I don't think it changes the name of event handlers such as Button1_Click.
  • Click-once deployment: There's a wizard that builds a package that basically lets a user click a link to install the project. Hopefully this will make it so you don't need a PhD in installation to install a project! There are still some tricky issues, however. For instance, imagine a big installation with hundreds of users. To install, they need permission to install applications on their machines. Normally users don't have those privileges so there is some network administration needed to let them.
  • You can set click-once parameters to allow the user to run from a desktop shortcut (called "online/offline") or to make them check for updates every time before running the local version (called "online only").
  • MenuStrip control. Basically a menu. I'm not sure how this related to the MainMenu control (they have the same icon and look pretty similar). The MenuStrip, and all controls it seems, have smart tags. You click the tag and a popup appears giving special functions of the control. For MenuStrip, the "Insert Standard Items" command makes it create File, Edit, Help, and other standard menus and submenus. It even gives them decent names by default such as fileToolStripMenuItem rather than MenuItem1. mnuFile would be better, though.
  • Similarly the ToolStrip control has a smart tag command to insert standard toolbar buttons.
  • Working with resources is a bit easier. See the next item.
  • Double-click MyApplication in the Project Explorer to see the project's properties (References, compiler settings, etc.). Select the Resources tab to create string, icon, picture, audio, files, and other resources. There seem to be some problems with this but it should let you easily assign images to toolbar buttons and the like.
  • Related: Double-click MyApplication and select Application to set properties such as root namespace, default icon for forms, splash screen, showdown mode (when startup form exits versus when the program exits), assembly information (company name, version, copyright, etc.), imported namespaces, and so forth.
  • There's a new My namespace. This does not add any new functions but creates a shortcut to stuff buried in the framework. It has child namespaces named Application, User, Computer, Forms, Webservices, and MyProject. These give access to different framework tools. (This list doesn't match other lists I have seen so it may still be changing.)
  • Examples:
        My.Computer.Audio.Play(filename)
        Dim contents As String = _
            My.Computer.FileSystem.ReadAllText("c:\mytextfile.txt")
        ...
        My.Application.Log.WriteException(ex, "Error Accessing INI File")
        ...
        For Each f As Form In My.Application.OpenForms
            ...
        Next f
    
        Dim myPics As String = _
            My.Computer.FileSystem.SpecialFolders.MyPictures.Path
    
        My.Computer.FileSystem.CopyFolderContents( _
            "C:\Desktop Wallpaper", myPics, False, True)
    
        MsgBox( My.Computer.FileSystem.GetFiles( _
            myPics, "*.jpg", "*.bmp").Count)
    
        MsgBox(My.User.Identity.Name)
    
  • See also the very informative article Navigate the .NET Framework and Your Projects with "My".
  • To localize an application, you set a form's Localiazble property to True. Then you set its Language property and the IDE automatically starts saving strings in resources. This doesn't seem to work properly yet.
  • Technique: for a multi-paned application, you can make the panes in separate UserControls that can contain any number of constituent controls. Then you just need to show and hide a single instance of each UserControl rather than a whole bunch of stuff. You can also use this trick in VS .NET 2003.
  • (I have been having trouble duplicating this but...) The presenter showed a Data Source window and clicked "Add new data source." The dialog let you pick from a lot of stuff including database (e.g. SQL Server instance), local database file (e.g. Access .mdb file that is to be installed with the application), Web Services, and Object (just about any class you create!). He selected Object and the IDE built a "schema" for the object, assigning default control types for the object's fields. For example, it assigned date/time picker controls to dates and text boxes to strings. You can change these assignments. He dragged the data source onto a form and it automatically generated appropriate labels, created the right controls, and attached them to a data connector object. Smart tags let you change the control types (e.g. you want a TextBox instead of a date/time picker).
  • The data connector provides binding for the controls and maintains currency (what record are you currently looking at?).
  • If you change the data connector's data source, it automatically updates all of the controls.
  • The presenter cut and pasted a few dozen lines of code to attach the data connector to a list of objects of the appropriate type and the program displayed the data automatically.
  • Question: Can a data connector bind to a class derived from the class that the connector normally binds? I.e. if you make it bind to a Person object, can it bind the derived Employee class? My wild guess is it probably can.
  • An audience member asked if this display would update if you modified the underlying data source (database, object, etc.) The answer was no. You would need to manually add or remove controls, change a binding field's name, etc.
  • "In situ property editor." If you rght-click a control and select Edit Properties, the IDE displays the properties right on the form above the controls. You select from a dropdown the property to display (Text, Name, etc.) and you can edit them on the form. The presenter mentioned color properties but I couldn't get that to work. You click a button to end this mode.
  • System.Collections.Generic: This lets you make strongly typed collections easily as in:
        Dim report_list As List(Of ExpenseReport)
  • The List class supercedes the ArrayList class from VS 2003 (although ArrayList seems to still be in the framework).
  • You can build generics as well as use them, although I haven't found the syntax for creating them in VB.
  • Generics can take more than one type. For example, a list of Employee or Customer objects.
  • Related: An Introduction to C# Generics.
  • TryCast. This is supposed to simplify code such as:
        If TypeOf obj Is Whatever Then _
            my_whatever = DirectCast(obj, Whatever)
  • Select text and right-click it. Select Create Snippet. This opens a snippet editor where you can mark code that probably needs to be replaced when the snippet is used (data types, etc.)
  • IntelliSense can tell when a snippet is appropriate. I.e. in a subroutine, at the module level, etc.
  • VS 2005 will include around 500 snippets.
  • Snippets are XML files so they will be easy to share (with people you trust).
Again, I encourage you to look into the tour. See when it will be in your area and register.

 

Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated