Passing data from vb.net to the open infopath form - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Passing data from vb.net to the open infopath form

Last post 07-24-2008 11:46 AM by srikrushna. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 07-17-2008 09:32 AM

    Passing data from vb.net to the open infopath form

    I am working on a solution, I need to be able to run calculations on infopath form fields and pass the data back to a field on the form.

    I am using the Xpathnavigator class to get the data from infopath.

    I can't figure out how to write the data back to the form that I have open.

     Is this possible?  Any help or hints would be appreciated.

    Thanks,

    Brooke

    SharePoint Solutions

    Brooke Hyde, MCP
    SharePoint Solutions
  • 07-17-2008 10:16 AM In reply to

    Re: Passing data from vb.net to the open infopath form

    Hello, and welcome!

    You need the .SetValue method of the XPathNavigator class. MSDN documentation is available here.

    Let me know if you need more specific assistance -- feel free to post your code....

    Hilary Stoupa

  • 07-17-2008 10:20 AM In reply to

    Re: Passing data from vb.net to the open infopath form

    Thanks for your quick response.  

    I tried using the .setvalue.

    I could never it it to work becuase it said the Xpathnavigator did not accept that data type. I tried this using double, int, and string

     eventually i figured out how to do this calculation using the formual box in code.

    I'm still curious why i could not save back to the form. I will have to figure this out for the next form I am going to develop,

     

     

    Brooke Hyde, MCP
    SharePoint Solutions
  • 07-17-2008 10:36 AM In reply to

    Re: Passing data from vb.net to the open infopath form

    Out of curiousity, what was the data type of the field you were trying to set the value on? .SetValue should take a string as a parameter....

    Hilary Stoupa

  • 07-17-2008 10:39 AM In reply to

    Re: Passing data from vb.net to the open infopath form

    It was a double.

    i even tried to change it to string and then use .setvalue

    Brooke Hyde, MCP
    SharePoint Solutions
  • 07-17-2008 10:55 AM In reply to

    Re: Passing data from vb.net to the open infopath form

    Check out this article on the xsi:nil attribute. That may be what was causing your difficulties.

    Hilary Stoupa

  • 07-21-2008 08:44 AM In reply to

    Re: Passing data from vb.net to the open infopath form

    Does anyone know of a good code example that pulls data from infopath to .net,  uses the values for calculations, and then passes a value back to infopath?

     I've tried alot of things but i still get unexpected errors when trying to do this.

     any help or hint would be appreciated.

     

    Brooke Hyde, MCP
    SharePoint Solutions
  • 07-23-2008 07:55 AM In reply to

    Re: Passing data from vb.net to the open infopath form

    Are you able to push the data from infopath to VB.NET application ? If you can, is it the other way to collect the data back to Infopath is making you trouble?

    If you are really looking for the solution to get the data from VB.NET application to infopath, I believe you can go with Query String parameters. Yes, through Query String parameters you can set the external application value to infopath.If you wish, I can provide you the code to do that.

    Thanks & Regards,
    Srikrushna Patro.
  • 07-23-2008 08:00 AM In reply to

    Re: Passing data from vb.net to the open infopath form

    I would like the code to be able to use the query string parameters.

     

    For this project, i figured out how to do this in javascript,  but i want to do my next one in vb.net or c#.

     

    thanks,

    Brooke Hyde, MCP
    SharePoint Solutions
  • 07-24-2008 11:46 AM In reply to

    Re: Passing data from vb.net to the open infopath form

     

    Hey, I feel sorry for the inconvenience. I don’t have the VB.NET code to that, infact I can give you the C# version of code. Hope you don’t mind. Here it goes.. public void FormEvents_Loading(object sender, LoadingEventArgs e)        {            XPathNavigator nav = MainDataSource.CreateNavigator();            

    string a = string.Empty;     

    string b = string.Empty; string c = string.Empty;             try            {                e.InputParameters.TryGetValue("a", out a);//Make sure the query string parameters should be all in lower case.             e.InputParameters.TryGetValue("b", out b); e.InputParameters.TryGetValue("c", out c);                       MainDataSource.CreateNavigator().SelectSingleNode("/dfs:myFields/my:a", NamespaceManager).SetValue(a);             MainDataSource.CreateNavigator().SelectSingleNode("/dfs:myFields/my:b", NamespaceManager).SetValue(b);             MainDataSource.CreateNavigator().SelectSingleNode("/dfs:myFields/my:c", NamespaceManager).SetValue(c);}            catch (Exception ex)             {             }}After collecting the values from query string, SetValue method persists the value in the form.  
    Thanks & Regards,
    Srikrushna Patro.
Page 1 of 1 (10 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.