Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / April 2007

Tip: Looking for answers? Try searching our database.

How to fill drop-down box with data programmatically

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andreas - 02 Apr 2007 16:42 GMT
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.Y.M. Wong-A-Ton - 04 Apr 2007 09:30 GMT
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.
---
S.Y.M. Wong-A-Ton

> I've got a problem.
> How can I fill down a drop-down box with data from code.
[quoted text clipped - 31 lines]
>
> Thank you!!!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.