Thursday, March 3, 2011

How to host a WPF control in an MS Access VBA Form?

We have a large MS Access project that requires GUI functionality that is difficult / impossible to do in the VBA / access forms environment.

Over time, we wish to re-write / migrate to a managed C# environment with WPF as the presentation layer.

The only practical way for us to do this is over a longer period of time - converting some of the VBA forms first (that would give the best productivity benefit), and then over the course of 12-24 months convert the entire system.

What do you believe is the best approach. Can MS Access host the WPF forms as we convert them?

From stackoverflow
  • What if you look into Visual Studio Tools for Office (VSTO) ? You can write managed .NET addins for Office in C#, that will integrate as ribbons with office.

    Now, the problem is that Access add-ins are not supported in VSTO AFAIK. But, take a look here, it seems to be not that impossible.

    So, if you happen to be lucky, you could

    • Write a C# ribbon for Access which would have all the advanced GUI you need
    • Write services in C# that could be accessed from Access to encapsulate important business logic for instance, so that you could gradually move not only GUI, but build proper domain object model in C#.

    If you decide to try it out, let me know how it turned out :) Good luck anyway.

    PS something else which maybe is helpful? Access 2007 Developer Extensions (ADE)

  • Thank you badbadboy - I will certainly experiment with this (using VSTO).

    The solution you suggested to allow VSTO to work with ms access, does seem slight hackery - not that I mind this, but I am nervous about using this work-around in production if it isn't solid i.e there would be no support from MS.

    From what I can see this will allow me to host a winforms control, that in-turn hosts a WPF control.

    Has anybody gone down this path with a production system - any caveats?

    Note there is a VSTO access project template on codeplex that makes the process a little easier.

0 comments:

Post a Comment