How to fill drop-down box with data programmatically

A

Andreas

I've got a problem.
How can I fill down a drop-down box with data from code.

1.I've got a drop-down box in a repeating table. How can I programmatically
fill down this box with data received fromm SQL so the user in could change
value manually. This data is subtracted from the SQL datasource according to
the value from another drop-down box.

This is the test code sample how can I add data. I neen an idea what tools I
have to use :

XPath of my box is :
"/my:myFields/my:table/my:group2/my:name"

root = _senderObject.MainDataSource.CreateNavigator();
try
{
root.MoveToChild("myFields", root.NamespaceURI);

root.MoveToChild("table", root.NamespaceURI);
root.MoveToChild("group2", root.NamespaceURI);
root.MoveToChild("name", root.NamespaceURI);
XmlWriter writer = root.AppendChild();
writer.WriteStartElement("my", "name",
"http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-10-12T06:46:39");
writer.WriteString("New data");
writer.WriteEndElement();
writer.Close(); //Here I receive a mistake.
}

But this doesn't work.

2. How can I extract xml schema from xsn. file?

Thank you!!!
 
S

S.Y.M. Wong-A-Ton

1. There is a CreateElement method you can use. Try using that with
AppendChild to add elements to the group node of the data source used for the
drop-down.
2. I'm not sure I understand your question. You can extract the form files
via the File menu in InfoPath. Those files will contain the XML schema
definition file for your form.
 

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