There are lots of documents on the Microsoft site that show examples of OnVersionUpgrade event handlers. For example: http://msdn.microsoft.com/en-us/library/office/bb229744(v=office.12).aspx
The 2003 SDK also has more examples of javascript (2003-2007-2010). JavaScript is not compatible for browser forms, but you can easily convert the code to C# or VB.NET for browser support.
Keep in mind that your code will depends on your form's source and target versions (data source) and what changes were made. It also depends on which version of InfoPath you are using (since 2003-2007-2010 all have different object models).
In general, I do not recommend writing code to do OnVersionUpgrade. Why? Because you have to keep track of all previous versions and the matrix explodes quickly creating a maintenance nightmare.
What I do recommend is one of the following approaches:
-
Side-by-side
-
On demand data migration
-
old version opens with old template, but with link to open in new version
-
link passes input parameter to new template
-
new template uses XSLT transform to map old fields (this is more data-driven and easier to maintain than code)
-
Bulk migration
-
use an XSLT tool (like Qdabra's free DBXL Migration tool or Altova's tools)
-
create an XSLT map for old data
-
run the tool on all old versions
During Qdabra's weekly webinar on 2013-08-23, Jennifer Lindsay discussed these techniques.
Thanks,