I've been writing custom code (C#) for a button in InfoPath 2007 that queries a webservice to return a dataset and then updates several fields on the form with values from said dataset. The functionality is basically so people can fill out a form and submit it and look up the data in the form and change values as need be. Right now I've no issues with setting the values of drop down lists, or text boxes as long as the values are strings.... but I've also got a few checkboxes and Date picker.
I'd like to be able to be able to programatically set values of nodes whether they are strings, ints, bools, or Date/time objects and haven't been able to find a method for this.
The method I'm using for setting values is to assign the node using the XPathNavigator to get the node then using the SetValue function to change the value. Unfortunatley the SetValue function only accepts string arguements, and will blow up the form if you set that value to a textbox that has been assigned a datatype of integer, or decimal.
I'm certain that if I can figure out this snag, figuring out how to set the values on the date pickers, and the check boxes will be no issue.
Thanks