<?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: unhiding optional sections depending on a number from a drop down list</title><link>https://www.infopathdev.com:443/forums/thread/82215.aspx</link><pubDate>Fri, 31 Aug 2012 16:53:18 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:82215</guid><dc:creator>rhatch</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/82215.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=82215</wfw:commentRss><description>&lt;p&gt;I am making a form that in step&amp;nbsp;1 you pick the number of cartons 1-20 , step 2 user&amp;#39;s info, step three details about the carton, I wanted to make step 3 add parts depending on the number of cartons requested and within that section depending on the issue change the section reflecting the issue. We already have this form and it works as a .asp using html and java script but are trying to migrate these forms to infopath and sharepoint, I am not a strong C# programmer and am very new to infopath and I was able to figure out how to add sections but only in form filler not as a blank form, I have been reading about conditional formatting&amp;nbsp; and have not seen how that would solve my problem?&lt;/p&gt;</description></item><item><title>Re: unhiding optional sections depending on a number from a drop down list</title><link>https://www.infopathdev.com:443/forums/thread/82192.aspx</link><pubDate>Fri, 31 Aug 2012 09:42:03 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:82192</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/82192.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=82192</wfw:commentRss><description>&lt;p&gt;Trying to use this approach is more headache and complications than it&amp;#39;s worth, unless you&amp;#39;ve got a really good reason.&lt;/p&gt;&lt;p&gt;The typical approach is to have an ordinary section and just use conditional formatting to hide or show it accordingly.&amp;nbsp; No code needed.&lt;/p&gt;</description></item><item><title>unhiding optional sections depending on a number from a drop down list</title><link>https://www.infopathdev.com:443/forums/thread/82185.aspx</link><pubDate>Thu, 30 Aug 2012 21:14:28 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:82185</guid><dc:creator>rhatch</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/82185.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=82185</wfw:commentRss><description>I figured out how to add one but what about if I want two or three to show based on the number of sections they need?


using Microsoft.Office.InfoPath;
using System;
using System.Windows.Forms;
using System.Xml;
using System.Xml.XPath;
using mshtml;

namespace TestForm
{
    public partial class FormCode
    {

        public void InternalStartup()
        {
            EventManager.XmlEvents[&amp;quot;/my:myFields/my:field2&amp;quot;].Changed += new XmlChangedEventHandler(field2_Changed);
        }

        public void field2_Changed(object sender, XmlEventArgs e)
        {
            if (e.NewValue.Equals(&amp;quot;1&amp;quot;))
                CurrentView.ExecuteAction(
                   ActionType.XOptionalInsert, &amp;quot;group2_2&amp;quot;);
            else
            {
                XPathNavigator node =
                   MainDataSource.CreateNavigator().SelectSingleNode(
                   &amp;quot;/my:myFields/my:group2&amp;quot;, NamespaceManager);
                CurrentView.SelectNodes(node, node, &amp;quot;CTRL4&amp;quot;);
                CurrentView.ExecuteAction(
                   ActionType.XOptionalRemove, &amp;quot;group2_2&amp;quot;);

                {


                }
            }
        }
    }
}</description></item></channel></rss>