in

MCW Technologies' Community Server

Downloads, blogs, forums, and more

Adventures in Visual Studio Development

Making Visual Studio easier to use, one blog entry at a time

September 2005 - Posts

  • The coolest thing I have seen in a long long time

    Paul showed off some VB 9.0 features today. He showed a lot of Linq demos, both DLinq and XLinq. One of his XLinq demos was tremendously cool. First he showed that VB now natively understands XML literals. You can write code like this

    Dim xmlFrag = _
      <Customers>
        <Customer>
          <CompanyName>Big Corp</CompanyName>
          <City>BiggeTowne</City>
        </Customer>
      </Customers>

    Then Paul opened an Excel spreadsheet that had a table with sample data as a placeholder. He saved the Excel as XML and then copied and pasted the XML into VB. He then created the following dLinq code

    Dim rows = _
      Select
        <row>
          <cell><%= r.Page :></cell>
        </row>
      From r in results

    Now for the coup de grace. He replaced the sample data in the Excel XML with the following:

    <%= rows>

    Then he wrote out a new spreadsheet

    Dim doc = New XDocument(body) ' body contains the pasted XML from the spreadsheet
    doc.Save("Report.xls")

    When he opened Report.xls, he had his Excel spreadsheet populated with the data returned by the query.

    This is so cool!!! Don't automate Excel and put the data in by hand. Don't programmatically have Excel import XML after mapping schemas and all that. Just put the data into the spreadsheet's XML from within VB and then save the XML as a new spreadsheet. I am blown away by this.

  • Customizing the Office 12 Ribbon

    The Office 12 ribbon groups common tasks into "tabs". Tabs consist of "chunks", which consist of controls. The new model for programmatically customizing the Ribbon is currently called RibbonX and it is a declarative XML format that lives inside a COM AddIn. Unlike the 2003 CommandBar object model, the Ribbon model works exactly the same across each of the Office 12 apps.

    The way you customize the Ribbon is by building a Shared AddIn. You then add a Connect class which implements IMsoRibbonExtensibility. The class manages the modifications you want to make to the Ribbon. The IMsoRibbonExtensibility interface has a single function, GetCustomUI, which returns the XML file that contains your modifications. VSTO V3 will have design time support for customizing the Ribbon.

    Here is some XML that adds a new tab with 2 chunks:.

    <tab id = "New tab" label = "Advanced">
      <chunk id="NewChunk" label="More Stuff">
        <button id="Button1" label="Go Go Go" onAction="DoSomething" />
      </chunk>
    </tab>

    In the AddIn you would write code similar to the following:

    Public Class Connect
      Implements IMsoRibbonExtensibility

      Private ResourceManager = New ResourceManager()

      Public Function GetCustomUI() As String
        Return Resources.GetString("RibbonMods.xml")
      End Function

    End Class

    I really like this. I like the use of XML. I like the consistency across applications. The only thing I don't like is that by default onAction refers to your VBA code. But that is what VS Tools for Office is for, right?

  • Impressions of Office 12

    One of the stars of the PDC has been Office 12, featured heavily in Bill Gates' opening keynote and again yesterday in Steven Sinofsky's general session. One of the main focuses (or is it foci) of Office 12 is a more intuitive UI. A more "results oriented" UI Microsoft calls it. It is too difficult to find features in Office apps. Word 2003 has close to 300 menu items, more than 30 toobars and close to 20 task panes. Customers ask for things that are already in the product. They didn't know the feature was already in there. So Microsoft wants to simplify the UI and limit the number of choices available to users, while making it easier to find what's already in the product. That's a major goal for Office 12. You will recall that it was also a major goal of Office 2003 and was the rationale for the adaptive menus. "We'll only show the more common menu choices at first and Office will learn over time what menu choices you make most often and hide the rest." Well there is only so much simplification you can do with 300 menu items, so a new approach is coming.

    The Ribbon

    Menus and toolbars are out. The Ribbon is in. Or more accurately: the technology that no later than Beta 2 will be known as the technology formerly known as the Ribbon. The Ribbon is designed to make it easier to find features and functionality in Office apps. No more wading through menus and toolbars. Less reliance on you finding the right dialog and then finding the right dropdown or button. And of course, a snazzier look and feel. Check out the a screenshot of the Ribbon. At the top are "tabs", such as Write, Insert, Page Layout. Select a tab and you don't get a drowdown list of menu items. Instead you see several groupings of icons. These groupings are currently known as "chunks". A chunk is a collection of related items. So the Font chunk has items related to working with fonts. You can see in the screenshot that a chunk has a much richer (and presumably more intuitive) look to it. Chunks support the usual assortment of rich controls and label them. And you can label them with "super tooltips", which hold more text than today's tooltips.

    Apparently, the Ribbon was the source of quite a bit of contention when the Office team presented the new UI to the Regional Directors (RDs) at the show. After seeing the Ribbon in the demos and playing with Office 12 in the Hands On Labs I will say that my first thought was that it looked pretty crowded in there. And having used Office for so many years and having grown accustomed to where on the menus things were, I found myself staring at the Ribbon and trying to learn the new groupings. But within an hour of using it I was growing pretty comfortable with it and starting to anticpate what items would be in what chunks and what chunks were in each tab. So don't judge it until you've used it and also understand that this is pre-Beta 1, so there will be plenty of tweaking and massaging of the UI before ship.

    The coolest thing about the Ribbon is how you customize it in code. The CommandBars object model still lives, but the new programming model is a declarative XML model. I will cover that in my next post.

  • VB Team at PDC

    PaulY has a good post outlining the VB team's activities at PDC. He also recommends visiting http://msdn.microsoft.com/vbasic/pdc05/ for more info.
  • Greetings from PDC

    I am writing this from the Los Angeles Convention Center, in Los Angeles, home of the PDC. I will be here all week, learning about what's coming in the future and also proctoring some Hands On Labs. I am officially proctoring SQL Server 2005 Hands On Labs but my good friend and former VB product team colleague Steve Lasker was on my flight down and he told me that there are VB Labs as well and that I wrote some of them back when I was on the VB team. So I think I can help proctor those as well, yes?

    The Technical Tracks at PDC this year are

    • Presentation - featuring Avalon (now called the Windows Presentation Foundation), IE7, Atlas
    • Data & Systems - featuring SQL 2005, WinFS, ADO.NET
    • Communications - featuring Indigo (now called the Windows Communications Foundation)
    • Fundamentals - the guts of Windows
    • Office & SharePoint - Office 12 and some VSTO
    • Tools & Languages - VS Orcas, Avalon for VS developers, VSTS, the .NET Language Integrated Query Framework, and next next versions of VB and C#

    Lots of stuff to see. There are a handful of Whidbey sessions, a few sessions on mixing Whidbey and Vista, but most of the sessions are on stuff that won't be shipping until next year and beyond.

    I'll blog daily on what I saw.

© Copyright MCW Technologies, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems