How can I know for sure that form is loaded into formControl1?
There is no event that fires or property being set.
Is there a way to monitor something on the formControl ?
There is no property explicitly for this.
You can try a few things
1) check if the XDocument property != null. You will need to implement some sort of polling/callback mechanism for this yourself.
2) handle the OnLoad or OnViewSwitch events from your host application (using the IConnectionPointContainer interface for C++ and delegates for .NET).
public partial class Form1 : Form
// sync to the startup event where you can register for individual events
formControl1.InternalStartup += new Microsoft.Office.InfoPath.FormControl.EventHandler<EventArgs>(formControl1_InternalStartup);
void formControl1_InternalStartup(object sender, EventArgs e)
// sync to the View switch event (you can also sync to other form events, such as Save, Merge, etc)
((FormControl)sender).EventManager.FormEvents.ViewSwitched += new ViewSwitchedEventHandler(OnSwitchView);
3) register to receive a callback during the Init event. This event fires before document OnLoad.
There should be documentation on MSDN for the details of this. Basically you need to implement IInitEventHandler interface and call its SetInitEventHandler passing in pointer to your callback function.