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 / November 2006

Tip: Looking for answers? Try searching our database.

Reference InfoPath 2007 Control?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
josepk@hotmail.com - 04 Nov 2006 13:24 GMT
Hello,

How does one go about referencing an InfoPath 2007 UI control via .NET
(C#) code?  For example, if I wanted to programmatically populate the
contents of a Combo Box called "field1" by looping through a dataset?

In normal Visual Studio.NET 2005 development (e.g. Windows Forms) I
would just reference the control "field1" directly within the code.
However, this does not appear to be the case in InfoPath 2007 - I'm
sure it's a syntax issue - just not sure how to do it.

Thanks!

Joe
Madhur - 04 Nov 2006 19:34 GMT
> Hello,
>
[quoted text clipped - 10 lines]
>
> Joe

The controls in infopath are not referenced directly. Instead you set there
values by setting the values of nodes on xml. The control represents an
XmlNode object.

--
Madhur Ahuja

http://madhurahuja.blogspot.com
josepk@hotmail.com - 04 Nov 2006 21:11 GMT
OK - can you give me an example or syntax on how that is accomplished?

> jos...@hotmail.com wrote:
> > Hello,
[quoted text clipped - 18 lines]
>
> http://madhurahuja.blogspot.com
kap - 07 Nov 2006 20:45 GMT
Here is an example
Check out your sample.xml for the xml structure

public void UpdateForm(DateTime startdate, int interval)
       {
           DOMNodeList SectionStartDateNodeList =
thisXDocument.DOM.selectNodes("//cp:gtl/cp:linklist/cp:link/my:startdate");
           DOMNodeList SectionEndDateNodeList =
thisXDocument.DOM.selectNodes("//cp:gtl/cp:linklist/cp:link/my:enddate");
           int count = SectionStartDateNodeList.length;
           string[] SectionList = new string[count];
           if (startdate != null)
           {

               for (int i = 0; i < count; i++)
               {

                   SectionStartDateNodeList[i].text =
startdate.ToShortDateString();
                   SectionEndDateNodeList[i].text =
startdate.AddDays(interval).ToShortDateString();
                   startdate = startdate.AddDays(interval + 1);
               }

               this.thisXDocument.View.ForceUpdate();
           }
       }

> OK - can you give me an example or syntax on how that is accomplished?
>
[quoted text clipped - 20 lines]
> >
> > http://madhurahuja.blogspot.com
 
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.