Grab repeating table values

F

Francisco

I am newbie at InfoPath. I want to get all the values in a repeating table.
I found this code in one questions but I am not able to make it work. I am
using InfoPath 2007 these are the error I got. Please help!

Errors:
'CreateNavigator' is not declared
'NamespaceManager' is not declared

Dim navigator As XPathNavigator = CreateNavigator()
Dim nodes As XPathNodeIterator = navigator.Select("/my:myFields/my:group2",
NamespaceManager)

While nodes.MoveNext()
MessageBox.Show(nodes.Current.SelectSingleNode("my:firstfieldinrow",
NamespaceManager).Value)
MessageBox.Show(nodes.Current.SelectSingleNode("my:secondfieldinrow",
NamespaceManager).Value)
End While
 
F

Francisco

I added the code to a button. Here is the modified code.

' The following function handler is created by Microsoft Office
InfoPath. Do not
' modify the type or number of arguments.
<InfoPathEventHandler(MatchPath:="btnSelect",
EventType:=InfoPathEventType.OnClick)> _
Public Sub btnSelect_OnClick(ByVal e As DocActionEvent)
Dim navigator As XPathNavigator = CreateNavigator()
Dim nodes As XPathNodeIterator = navigator.Select("/my:emailTo",
NamespaceManager)

While nodes.MoveNext()

MsgBox(nodes.Current.SelectSingleNode("/emailTo/additionalEmail",
NamespaceManager).Value)
End While

End Sub
 
E

Ed Thurber

The CreateNavigator method needs a parent object.

Either MainDataSource.CreateNavigator()

or

DataSources["Data Source Name"].CreateNavigator()

Ed
 
F

Francisco

Ed,

I am a newbie at InfoPath. I have been reading the documentation and I
still cannot make it work. I tried what you suggested, but I still cannot
make it work. The table is not bound to any database. All I want to do is
to grab the values entered by user into the reapiting table. Somehow I get
declaration problems. I am using all these libraries. Could that I do not
have the correct libraries? Many thanks.

Imports System
Imports Microsoft.Office.Interop.InfoPath.SemiTrust
Imports Microsoft.VisualBasic
Imports System.Xml.XPath

Ed Thurber said:
The CreateNavigator method needs a parent object.

Either MainDataSource.CreateNavigator()

or

DataSources["Data Source Name"].CreateNavigator()

Ed

Francisco said:
I added the code to a button. Here is the modified code.

' The following function handler is created by Microsoft Office
InfoPath. Do not
' modify the type or number of arguments.
<InfoPathEventHandler(MatchPath:="btnSelect",
EventType:=InfoPathEventType.OnClick)> _
Public Sub btnSelect_OnClick(ByVal e As DocActionEvent)
Dim navigator As XPathNavigator = CreateNavigator()
Dim nodes As XPathNodeIterator =
navigator.Select("/my:emailTo",
NamespaceManager)

While nodes.MoveNext()

MsgBox(nodes.Current.SelectSingleNode("/emailTo/additionalEmail",
NamespaceManager).Value)
End While

End Sub
 
E

Ed Thurber

Sorry for not getting back to you sooner.

These are my "usings"
using Microsoft.Office.InfoPath;
using System;
using System.Windows.Forms;
using System.Xml;
using System.Xml.XPath;
using mshtml;

Here are my references
Microsoft.MSHTML
Microsoft.fOffice.InfoPath
Microsoft.VisualStudio.Tools.Applications.Adapter
Microsoft.VisualStudio.Tools.Applications.Contract
System
System.AddIn.Contract
System.Windows.Forms
System.Xml

MainDataSource is in Microsoft.Office.InfoPath as is DataSources[].

Ed

Francisco said:
Ed,

I am a newbie at InfoPath. I have been reading the documentation and I
still cannot make it work. I tried what you suggested, but I still cannot
make it work. The table is not bound to any database. All I want to do
is
to grab the values entered by user into the reapiting table. Somehow I
get
declaration problems. I am using all these libraries. Could that I do not
have the correct libraries? Many thanks.

Imports System
Imports Microsoft.Office.Interop.InfoPath.SemiTrust
Imports Microsoft.VisualBasic
Imports System.Xml.XPath

Ed Thurber said:
The CreateNavigator method needs a parent object.

Either MainDataSource.CreateNavigator()

or

DataSources["Data Source Name"].CreateNavigator()

Ed

Francisco said:
I added the code to a button. Here is the modified code.

' The following function handler is created by Microsoft Office
InfoPath. Do not
' modify the type or number of arguments.
<InfoPathEventHandler(MatchPath:="btnSelect",
EventType:=InfoPathEventType.OnClick)> _
Public Sub btnSelect_OnClick(ByVal e As DocActionEvent)
Dim navigator As XPathNavigator = CreateNavigator()
Dim nodes As XPathNodeIterator =
navigator.Select("/my:emailTo",
NamespaceManager)

While nodes.MoveNext()

MsgBox(nodes.Current.SelectSingleNode("/emailTo/additionalEmail",
NamespaceManager).Value)
End While

End Sub



:

I am newbie at InfoPath. I want to get all the values in a repeating
table.
I found this code in one questions but I am not able to make it work.
I
am
using InfoPath 2007 these are the error I got. Please help!

Errors:
'CreateNavigator' is not declared
'NamespaceManager' is not declared

Dim navigator As XPathNavigator = CreateNavigator()
Dim nodes As XPathNodeIterator =
navigator.Select("/my:myFields/my:group2",
NamespaceManager)

While nodes.MoveNext()
MessageBox.Show(nodes.Current.SelectSingleNode("my:firstfieldinrow",
NamespaceManager).Value)

MessageBox.Show(nodes.Current.SelectSingleNode("my:secondfieldinrow",
NamespaceManager).Value)
End While
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top