<?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: FormState["_memberVariable"] = Class</title><link>https://www.infopathdev.com:443/forums/thread/44767.aspx</link><pubDate>Wed, 22 Jul 2009 06:07:16 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:44767</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/44767.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=44767</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m not sure why it has to be inconvenient.&amp;nbsp; You could do something like:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;private XPathNavigator m_mRoot;&lt;br /&gt;private XPathNavigator mRoot&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(m_mRoot == null)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;m_mRoot = // insert logic to produce mRoot&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return m_mRoot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;That will work if mRoot is always supposed to be pointing to the same spot.&amp;nbsp; Will that work?&lt;/p&gt;
&lt;p&gt;That should be easy enough to use.&lt;/p&gt;</description></item><item><title>Re: FormState["_memberVariable"] = Class</title><link>https://www.infopathdev.com:443/forums/thread/44766.aspx</link><pubDate>Wed, 22 Jul 2009 04:04:32 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:44766</guid><dc:creator>Scroll</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/44766.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=44766</wfw:commentRss><description>Course, I can store XPathNavigator locally (So I did now), but it is inconvenient. I need for each function to create a new variable.</description></item><item><title>Re: FormState["_memberVariable"] = Class</title><link>https://www.infopathdev.com:443/forums/thread/44719.aspx</link><pubDate>Tue, 21 Jul 2009 14:00:58 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:44719</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/44719.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=44719</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;I don&amp;#39;t work with browser-enabled forms so I&amp;#39;ve never used the form state, but could you tell us why you want to store an XPathNavigator globally?&amp;nbsp; I can&amp;#39;t think of a whole lot of reasons why you would need to.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: FormState["_memberVariable"] = Class</title><link>https://www.infopathdev.com:443/forums/thread/44712.aspx</link><pubDate>Tue, 21 Jul 2009 11:18:58 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:44712</guid><dc:creator>Scroll</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/44712.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=44712</wfw:commentRss><description>Hi!&lt;br /&gt;
I have code:&lt;br /&gt;
private XPathNavigator mRoot&lt;br /&gt;
{&lt;br /&gt;
            get{return (XPathNavigator)FormState[&amp;quot;mRoot&amp;quot;];}&lt;br /&gt;
            set { FormState[&amp;quot;mRoot&amp;quot;] = value; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
XPathNavigator is not serializable. How I can use this class in FormState? If I can&amp;#39;t use it then how I can create global XPathNavigator variable in browser-enabled form?</description></item><item><title>Re: FormState["_memberVariable"] = Class</title><link>https://www.infopathdev.com:443/forums/thread/24599.aspx</link><pubDate>Wed, 21 Nov 2007 12:50:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:24599</guid><dc:creator>davidair</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/24599.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=24599</wfw:commentRss><description>&lt;p&gt;You can store any objects in FormState as long as they are serializable. To mark a class as serializable you can add the &lt;font size="2"&gt;[System.&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;SerializableAttribute&lt;/font&gt;&lt;font size="2"&gt;()] to your class definition.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;In your case this will not work because SPListItemCollection is already not serializable. One approach here would be to re-create it every time the business logic is called.&lt;/p&gt;</description></item><item><title>Re: FormState[&amp;quot;_memberVariable&amp;quot;] = Class</title><link>https://www.infopathdev.com:443/forums/thread/14955.aspx</link><pubDate>Thu, 14 Dec 2006 16:15:42 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14955</guid><dc:creator>Kun</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14955.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14955</wfw:commentRss><description>&lt;blockquote id="quote"&gt;&lt;font size="1" face="Verdana, Arial, Helvetica" id="quote"&gt;quote:&lt;hr height="1" noshade id="quote"&gt;are you writing this in codebehind an InfoPath form or is this a SharePoint web part? Can you give us some context here?&lt;br /&gt;&lt;hr height="1" noshade id="quote"&gt;&lt;/font id="quote"&gt;&lt;/blockquote id="quote"&gt;&lt;br /&gt;&lt;br /&gt;It's a codebehind file, "FormCode.cs", VSTA. Not a webpart! Does this help?</description></item><item><title>Re: FormState[&amp;quot;_memberVariable&amp;quot;] = Class</title><link>https://www.infopathdev.com:443/forums/thread/14954.aspx</link><pubDate>Thu, 14 Dec 2006 15:40:05 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14954</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14954.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14954</wfw:commentRss><description>Hi Kun,&lt;br /&gt;&lt;br /&gt;I'm confused by this code - are you writing this in codebehind an InfoPath form or is this a SharePoint web part? Can you give us some context here?</description></item><item><title>FormState["_memberVariable"] = Class</title><link>https://www.infopathdev.com:443/forums/thread/13004.aspx</link><pubDate>Wed, 13 Dec 2006 13:08:52 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13004</guid><dc:creator>Kun</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13004.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13004</wfw:commentRss><description>Is it just possible to store elementary data types in FormState[]? I want to do something like that:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;private SPListItemCollection _memberVariable&lt;br /&gt;        {&lt;br /&gt;            get&lt;br /&gt;            {&lt;br /&gt;                return FormState["_memberVariable"] as SPListItemCollection;&lt;br /&gt;            }&lt;br /&gt;            set&lt;br /&gt;            {&lt;br /&gt;                FormState["_memberVariable"] = value;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;and access it:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;_memberVariable = list.GetItems(query);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Then I get the following exception:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;System.Runtime.Serialization.SerializationException was unhandled by user code&lt;br /&gt;  Message="Serialization error."&lt;br /&gt;  Source="Microsoft.Office.InfoPath.Client.Internal.Host"&lt;br /&gt;  StackTrace:&lt;br /&gt;       at Microsoft.Office.InfoPath.Internal.FormStateBagHost.System.Collections.IDictionary.set_Item(Object key, Object value)&lt;br /&gt;       at CommunicationSet.FormCode.set__memberVariable(SPListItemCollection value) in (...)&lt;br /&gt;Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent)&lt;br /&gt;       at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)&lt;br /&gt;&lt;/pre&gt;</description></item></channel></rss>