Windows Form - ComboBox value copy to a field C# - InfoPath Dev
in

InfoPath Dev

Having trouble finding a blog or post that answers your question? Check out our Custom Search Page

Windows Form - ComboBox value copy to a field C#

Last post 02-21-2016 04:10 AM by Nandrew. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 11-11-2014 06:34 AM

    • Nandrew
    • Not Ranked
    • Joined on 09-11-2011
    • Hungary
    • Posts 11

    Windows Form - ComboBox value copy to a field C#

    Hello!

     

    I’m quite new in c# and I have a problem and don't know what to do :(. I have an IP2010 form, with a windows form (form1) and a combobox (comboBox1) and a field (/my:fields/my:field1).

     

    I’d like to do, when the value of the combo box changing, I want to copy the new value of the combobox to the field. But, it’s not working L

     

    I think, the solution would be this:

     

    Form1.cs

     

    private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)

            {

                if (comboBox1.Text != null)

                           

    XmlNamespaceManager ns = this.NamespaceManager;

                XPathNavigator ch1 = MainDataSource.CreateNavigator();

                XPathNavigator ch2 = ch1.SelectSingleNode("/my:fields/my:filed", ns);

     

                ch2.SetValue(ComboBox1.Text);

      }

     

     

    But I can’t create NamespaceManager and DataSource, CreateNavigator, because of this: „'TST_64.Form1' does not contain a definition for 'NamespaceManager'”, or „The name 'MainDataSource' does not exist in the current context”, etc..

     

    What should I do? L What is wrong? Can anybody help me?

     

    Thank you in advance for your help. 

  • 02-21-2016 04:10 AM In reply to

    • Nandrew
    • Not Ranked
    • Joined on 09-11-2011
    • Hungary
    • Posts 11

    Re: Windows Form - ComboBox value copy to a field C#

    The solution: Form --> Infopath Field Great post from Jimmy: http://www.infopathdev.com/forums/p/9305/33475.aspx#33475 Big THX for it!! InfoPath field --> Windows Form 1. Concat selected data to a variable 2. Copy the variable to the clipboard 3. In the form: copy back data from the clipboard to a local variable (Form loading event) 4. Cut the variable many parts, as you need I now, that not so elegant, but it works and perfect to me. :)
Page 1 of 1 (2 items)
Copyright © 2003-2017 Qdabra Software. All rights reserved.
View our Terms of Use.