i have three fields (s_john, t_john, Cost) on a infopath form. i defined data type as Decimal(double) for all of the fields. I am trying to run the code below when user clicks a button.
XPathNavigator root = MainDataSource.CreateNavigator();
double JohnSalary = root.SelectSingleNode("my:myFields/my:Salary/my:s_john", NamespaceManager).Value;
double JohnWorkHours = root.SelectSingleNode("my:myFields/my:TotalHours/my:t_john", NamespaceManager).Value;
double asd = JohnSalary * JohnWorkHours;
root.SelectSingleNode("my:myFields/my:Cost", NamespaceManager).SetValue(asd);
However i am getting the errors below:
Error 1 Cannot implicitly convert type 'string' to 'double' C:\Documents and Settings\eyilmaz\My Documents\InfoPath Projects\Template15\FormCode.cs 40 33 Template1
Error 2 Cannot implicitly convert type 'string' to 'double' C:\Documents and Settings\eyilmaz\My Documents\InfoPath Projects\Template15\FormCode.cs 41 36 Template1
Error 3 Cannot convert method group 'SetValue' to non-delegate type 'double'. Did you intend to invoke the method? C:\Documents and Settings\eyilmaz\My Documents\InfoPath Projects\Template15\FormCode.cs 44 13 Template1
What am i missing here?
Thank You.