Code behind infopath

T

Tina

I want to enter a file name and path in a textbox. I want to infopath
to check a radiobutton based on whether the file exists or not.

Is this possible in Infopath?

i would like to use c# for the code module.
 
D

David Fries [MSFT]

Interesting request, but I believe it is possible.
InfoPath has a data based programming model, so you should think of things
as nodes in your xml, rather than controls on the form, at least when it
comes to programming.

Here's how to get the value of a textbox in C#.
string filename = thisXDocument.DOM.selectSingleNode("//my:field1").text;
You can then use .NET Framework classes (Probably System.IO) to see if the
file exists or not.

Once you know whether the file exists or not, you can set the value of the
node that the radio button is bound to like so:
thisXDocument.DOM.selectSingleNode("//my:field2").text = "false";

Thanks,
Dave
 
Top