<?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: current doc object C# &amp; InfoPath07</title><link>https://www.infopathdev.com:443/forums/thread/39809.aspx</link><pubDate>Sat, 21 Mar 2009 12:14:20 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:39809</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/39809.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=39809</wfw:commentRss><description>&lt;p&gt;Hi --&lt;/p&gt;
&lt;p&gt;There is a difference between IP2003 and 2007 object models. The example you are following is probably IP2003. You can either change your form to use the older OM, so you can follow the sample, or you can try to upgrade the sample code.&lt;/p&gt;
&lt;p&gt;To change your form, under &lt;strong&gt;Tools / Form Options / Programming&lt;/strong&gt; you can remove your existing code and change the programming language to C# (InfoPath 2003). To try to update the code, you can use &lt;a href="http://msdn.microsoft.com/en-us/library/bb643160.aspx"&gt;this&lt;/a&gt; article from MSDN as a guide.&lt;/p&gt;
&lt;p&gt;Use &lt;strong&gt;&lt;em&gt;this&lt;/em&gt;&lt;/strong&gt; to refer to the current document in C# for 2007 (&lt;strong&gt;&lt;em&gt;Me&lt;/em&gt;&lt;/strong&gt; for VB.NET). &lt;/p&gt;
&lt;p&gt;In IP2007, to get the value of a field:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div style="PADDING-RIGHT:0in;MARGIN-TOP:0in;PADDING-LEFT:0in;FONT-SIZE:11pt;MARGIN-BOTTOM:10pt;LINE-HEIGHT:115%;"&gt;&lt;span style="FONT-SIZE:10pt;"&gt;&lt;span style="FONT-SIZE:10pt;"&gt;&lt;font face="Courier New"&gt;MainDataSource.CreateNavigator().SelectSingleNode(&lt;font color="#a31515"&gt;&amp;quot;/my:myFields/my:textField&amp;quot;&lt;/font&gt;, &lt;font color="#0000ff"&gt;this&lt;/font&gt;.NamespaceManager).Value&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;</description></item><item><title>current doc object C# &amp; InfoPath07</title><link>https://www.infopathdev.com:443/forums/thread/39800.aspx</link><pubDate>Fri, 20 Mar 2009 22:09:24 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:39800</guid><dc:creator>dpenny</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/39800.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=39800</wfw:commentRss><description>&lt;p&gt;Am a newbie at C# behing InfoPath07 forms. Am doing simple things like MsgBox of various fields. I can&amp;#39;t get the following to work because I cannot figure out how to get the current form (document) as an object.&lt;/p&gt;
&lt;p&gt;thisXdocument.DOM.selectSingleNode(xpath blah.....blah).value&lt;/p&gt;
&lt;p&gt;The example I am following gets thisXdocument from _Startup method. But I do not have one of these in the stubs provided by the environment.&lt;/p&gt;
&lt;p&gt;I am on an Office07&amp;nbsp;XP machine with VSTA. No VisualStudio at all.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>