Hello Rob,
InfoPath 2007 comes with a new Object Model so by default, you will not see thisXDocument or thisApplication. It is still possible to use the old 2003 OM if you choose to. However, before going into this, could you please tell me how your code will be interacting with InfoPath? In IP2007, there are three ways:
1. Your code is running of an InfoPath form.
2. Your code is running in a separate application and you externally automate InfoPath.
3. (new in IP2007) Your code is running in a WinForms application and you are hosting an InfoPath control.
For #1, you have an option of either using the old OM (make sure you design a form without checking the "Enable browser-compatible features only", then go to Tools |Form Options | Programming and select "C# (InfoPath 2003 Compatible)" in the Form Template code language dropdown. Then the generated code will contains thisApplication.
On the other hand, it is preferable to use the new OM. Then you will be using this.Application instead of thisApplication (this will refer to the XmlFormHost object instance). However I am not sure how to open a new form in the new OM (check the MSDN documentation for IP2007 here:
http://msdn2.microsoft.com/en-us/library/bb187369.aspx)
For #2, create a simple .NET application, add references to Microsoft.Office.Interop.InfoPath and Microsoft.Office.Interop.InfoPath.Xml and then you can launch InfoPath, open a form and edit a field value in three lines of code:
ApplicationClass infoPathApplication = new ApplicationClass();
XDocument document = infoPathApplication.XDocuments.NewFromSolution(yourXsnPath);
document.DOM.selectSingleNode(someXPath).text = someValue;
For #3, add a Microsoft.Office.InfoPath.FormControl to your WinForm. You can then call NewFromFormTemplate() on the form control to load an XSN (you can provide a stream to your XML instance as well) and then you can programmatically change the values via formControl.XmlForm.MainDataSource.
Hope that helps!
David Airapetyan / Software Services ArchitectQdabra® Software / Streamline data gathering to turn process into knowledge