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

Tip: Looking for answers? Try searching our database.

Clearing Date Fields in Managed Codes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
BethA - 13 Dec 2006 05:06 GMT
I would like to clear some date fields as part of some managed code behind a
button on my form. I can do it through rules, but I can't figure out how to
make it work in code. Help would be appreciated!

Thanks,
Beth A.
S.Y.M. Wong-A-Ton - 16 Dec 2006 03:20 GMT
Clear the contents of the date field and then add an xsi:nil attribute to the
node.

In C# code for InfoPath 2003:

thisXDocument.DOM.selectSingleNode("//my:dateField").text = "";
IXMLDOMNode attr = thisXDocument.DOM.createNode(DOMNodeType.NODE_ATTRIBUTE,
"nil", "http://www.w3.org/2001/XMLSchema-instance");
attr.text = "true"
thisXDocument.DOM.selectSingleNode("//my:dateField").attributes.setNamedItem(attr);

---
S.Y.M. Wong-A-Ton

> I would like to clear some date fields as part of some managed code behind a
> button on my form. I can do it through rules, but I can't figure out how to
> make it work in code. Help would be appreciated!
>
> Thanks,
> Beth A.
 
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.