Programmatically add item to drop-down list

S

Stout

Is it possible to add items to a drop-down list in Infopath using c#
code?

I am trying to bring in a list of items from a table in a sql database
and add them to the drop-down.

Thanks.

Bill
 
E

Ed Thurber

If you create a data connection to the SQL database, then you don't need
code. simply bind the list box entries to the datasource and select the
field that you want to display.

alternately, you can do it with code by writing your values to a secondary
XML data source and the binding your list box entries to that datasource.

hope this helps

Ed
 
S

S.Y.M. Wong-A-Ton

Yes, you can, but you would have to programmatically copy the items from the
secondary data source to the secondary data source of the XML file. I don't
have code for that (only a solution that copies data from a secondary data
source to the Main).

As Ed Thurber (the person who replied first to your question) already
highlighted, you do not need to write code if you already have a secondary
data source. Just bind it to the drop-down list box and off you go.

Is there any particular reason why you *want* to write code?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top