Problem: You want to retrieve the contents of a text box on a form.
In InfoPath create a form and add a TextBox, name it "Field 1" and set it's default value to "Hello, this is my default value".
On the field task pane, select "Field 1" right click and select "Copy XPath".
Add the code below on FormEvents_Loading() event handler:
Dim mainDS As XPathNavigator = MainDataSource.CreateNavigator
Dim Field1 As XPathNavigator = mainDS.SelectSingleNode("/my:myFields/my:field1", NamespaceManager)
Dim val As String = Field1.Value
Set a breakpoint on the line after the last line of code and press F5. Verify that the variable "val" has the same value as Field 1.
No comments:
Post a Comment