Hi,
I have a small VB program with a list of employees. When I click on one
employee, I would like the employee ID to be passed to InfoPath (which I
call during the click) in order to feed the ID as a parameter to a Web
Service (second data source in my IP form). At this point, I have no XML
file yet. I just want to pre-populate a few fields (name, age, etc.) based
on the ID.
What's the best way to do this? Looks like it should be simple..but can't
figure it out.
Thanks
vbdev
Alexander Prozor - 02 Sep 2004 09:21 GMT
you can get DOM of XDocument ( after registering of solution ).
find elements ( fields ) that you willing to fill and set its values.
sorry, I can't give you a VB example.
you can get the main idea from this c# code:
infoPathApp.RegisterSolution(fileName, "overwrite");
infoPathApp.XDocuments.NewFromSolution(fileName);
XDocument document = infoPathApp.XDocuments[infoPathApp.XDocuments.Count
-1];
foreach(System.Data.DataColumn column in _ProcessContext.Tables[0].Columns)
{
string fieldName = column.Caption;
node = infopathDOMDocument.selectSingleNode ("//my:"+fieldName);
if(node != null)
{
string fieldValue =
_ProcessContext.Tables[0].Rows[0][fieldName].ToString();
node.text = fieldValue;
}
}
> Hi,
>
[quoted text clipped - 10 lines]
>
> vbdev
vb6dev2003 - 02 Sep 2004 19:22 GMT
Thanks
vbdev
> you can get DOM of XDocument ( after registering of solution ).
> find elements ( fields ) that you willing to fill and set its values.
[quoted text clipped - 33 lines]
> >
> > vbdev