<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: activex control with managed code: re-instantiated when value changes</title><link>https://www.infopathdev.com:443/forums/thread/20621.aspx</link><pubDate>Tue, 12 Jun 2007 14:21:28 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20621</guid><dc:creator>yellowseed</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20621.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20621</wfw:commentRss><description>&lt;p&gt;Ah:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Main reason for this issue is, whenever a data field that is bound to
your ActiveX is changed, InfoPath destroys your control and create a
new one. This is mainly because InfoPath has to apply your view xsl to
your data source to create the view you see on the display. Every time
data source changes, InfoPath re-applies the xsl file and creates the
view from scratch for controls that are bound to changed data fields.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Courtesy of the InfoPath Team blog: &lt;a href="http://blogs.msdn.com/infopath/archive/2006/12/18/creating-complex-infopath-controls-in-c-sharp.aspx" title="Creating Complex InfoPath Controls in C#"&gt;Creating Complex InfoPath Controls in C#&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>activex control with managed code: re-instantiated when value changes</title><link>https://www.infopathdev.com:443/forums/thread/20604.aspx</link><pubDate>Mon, 11 Jun 2007 21:03:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20604</guid><dc:creator>yellowseed</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20604.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20604</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m new to COM and have been working on a custom InfoPath control.&amp;nbsp; It&amp;#39;s written in C#, implements the InfoPathControl interface, and generally works as expected&amp;nbsp; - Yay!&amp;nbsp; Sometimes, though, InfoPath &amp;quot;re-instantiates&amp;quot; the control.&amp;nbsp; It usually happens in response to ValueChanged events when the new value is not an empty string.&amp;nbsp; I&amp;#39;ve implemented the InfoPathControl interface as recommended by Roberts &amp;amp; Green:&lt;br /&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;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; }&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now I&amp;#39;m finding this.infoPathControlSite is set to null after these ValueChanged events, which is bad because I want to make changes to &lt;em&gt;other&lt;/em&gt; column values in response to changes in this one.&amp;nbsp; 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&amp;#39;m doing something wrong?&amp;nbsp; Or does InfoPath treat all ActiveX controls this way?&lt;/p&gt;&lt;p&gt;Thanks,&lt;br /&gt;-- Joshua&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>