Populating Listbox using managed code. - InfoPath Dev
in

InfoPath Dev

Populating Listbox using managed code.

Last post 10-05-2005 05:47 AM by Abhishek. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 09-28-2005 07:08 AM

    Populating Listbox using managed code.

    To place a value in a textbox field,I use the following code
    thisXDocument.DOM.selectSingleNode("/my:myFields/my:field3").nodeTypedValue =.............

    But I need to populate a listbox with values.
    So what is the right syntax to populate values into a listbox?

    For example in .net,we use list1.Items.Add()
    In the similar fashion,how do u do it for a listbox in Infopath???
  • 09-28-2005 08:06 AM In reply to

    Re: Populating Listbox using managed code.

    Hi Abhishek,
    You need to insert the values into the xml to which your listbox is bound.
    Here it works this way, Your listbox will show all of the rows that are present in the xml. When you add rows to your xml then you are adding items to your listbox control.

    Agni
    InfoPath Dev India
  • 09-28-2005 11:27 PM In reply to

    Re: Populating Listbox using managed code.

    I still dint understand u,when u tell me to insert values into the XML to which my list box is bound.

    Do u mean to say that I have to
    1)"Look up values in the form's data source"(in the Listbox Properties dialog) and bind the listbox to a repeating group
    2)Populate the repeating group fields with values using managed code so that my listbox gets updated automatically.

    If so,then I need to know the syntax as to how I can access the individual rows/items of the repeating group becoz I need to use a loop to populate it.
    Thanks in advance,
    Regards
    Abhishek
  • 09-30-2005 09:05 AM In reply to

    Re: Populating Listbox using managed code.

    There are two ways to populate a list box:

    1. Use the InfoPath Designer to point your list box to a list of nodes from which it will populate.

    2. Use code to populate your list box.

    Populate a Drop-Down List Box via Code
    You should look at:
    http://www.infopathdev.com/howto/tutorials/default.aspx?i=987250af134b4ced85cbddc7db724202

    and

    Populate a Drop-Down List Box via a Secondary Data Source
    http://www.infopathdev.com/howto/tutorials/default.aspx?i=7f693c75c5c94604b01bdfd3a1edaedc

    If you are using the Designer to populate your list box from a repeating list of nodes, then to add a new item to your list, you need to add a new node to the list of nodes.

    Greg Collins [InfoPath MVP]
    InfoPath Dev
  • 10-05-2005 05:47 AM In reply to

    Re: Populating Listbox using managed code.

    Thank you very much to both Greg and Agni for your kind help.
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.