I'm new to COM and have been working on a custom InfoPath control. It's written in C#, implements the InfoPathControl interface, and generally works as expected - Yay! Sometimes, though, InfoPath "re-instantiates" the control. It usually happens in response to ValueChanged events when the new value is not an empty string. I've implemented the InfoPathControl interface as recommended by Roberts & Green:
public void Enable(bool vfEnabled) { this.Enabled = vfEnabled; }
public void Init(InfoPathControlSite pControlSite) { this.infoPathControlSite = pControlSite; }
public void SaveState() { }
public void Uninit() { this.infoPathControlSite = null; }
Now I'm finding this.infoPathControlSite is set to null after these ValueChanged events, which is bad because I want to make changes to other column values in response to changes in this one. Of course any suggestions are welcome (like: is it ok to use infoPathControlSite after Uninit has been called?), but this re-instantiating seems like a bug -- is it likely I'm doing something wrong? Or does InfoPath treat all ActiveX controls this way?
Thanks,
-- Joshua