Drop down list code - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Drop down list code

Last post 06-05-2012 11:39 PM by Crazy-Ninja. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 05-24-2012 01:18 AM

    Drop down list code

    How would I go about populating a drop down list using vb.net code. Is there anything special I would need to do in order to access and add new values in the drop down list.
    Crazy-Ninja
    .Net Developer
  • 05-24-2012 03:05 AM In reply to

    You will need to set the dropdown to populate from a repeating group in either the main or a secondary source.  Then you can use code to manipulate the XML items in that repeating group.
    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 05-31-2012 02:35 AM In reply to

    OK for the first drop down list, the code runs perfectly when the form loads. from the selection of this drop down list I want to populate the next drop down list. So all I did was copy and paste the exact same code into the changed event. I have attached my code the 5th line of code "nav.SelectSingleNode("/my:myFields/my:SectionA/my:names", NamespaceManager).SetValue("")" gives me the following error: Operation is not valid, because of the current state of the object. Any Idea what is wrong?
    Crazy-Ninja
    .Net Developer
  • 05-31-2012 03:51 AM In reply to

    Are you sure you put that in the Changed event, and not the Changing event?  I would expect trying to modify the data source during a Changing event to produce an error like that.
    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 05-31-2012 04:10 AM In reply to

    thanks, it was a changing event rather than a changed event
    Crazy-Ninja
    .Net Developer
  • 05-31-2012 07:12 AM In reply to

    Ok next problem with the same dropdownlists... when a user makes a selection in the drop down list, it populates the next drop down list... OK that all works correctly now... the problem comes in when a user goes back to the original drop down list and selects something else, I need the repeating group to drop all of its values and load a new set, because the previous values still come up... I tried to delete the values, but i just ended up with an object null exception.... Any Ideas?
    Crazy-Ninja
    .Net Developer
  • 05-31-2012 07:59 AM In reply to

    What does the delete code look like?
    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 05-31-2012 11:10 PM In reply to

    here it is...
    Crazy-Ninja
    .Net Developer
  • 06-01-2012 04:28 AM In reply to

    That looks like it should work, except that it will cause a NullReferenceException if there are no items in the list yet.  Try using an If statement to skip the rest of the subroutine if group2NodesCount is 0.
    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 06-05-2012 11:39 PM In reply to

    Not sure what I'm doing wrong... Here is how I edited the code to skip the rest of the subroutine if group2NodesCount is 0
    Crazy-Ninja
    .Net Developer
Page 1 of 1 (10 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.