InfoPath 2007 insertrow

B

BobC

I have code that works in InfoPath 2003:
Dim nodeRowStart As XPathNavigator =
e.Source.SelectSingleNode("/d:WorkOrders/d:Activity[1]",
NamespaceManager)
If nodeRowStart Is Nothing Then
System.Windows.Forms.MessageBox.Show("nodeRowStart not
valid")

Else

' insert the row insert before will place it on top.

Me.CurrentView.ExecuteAction("XCollectionInsertBefore",
"Activity_10")

End If

This no longer works in 2007.

The updated line

Me.CurrentView.ExecuteAction(ActionType.XCollectionInsertBefore,
"Activity_10")

The specified bstrAction value for the View.ExecuteAction call is not
applicable for the current selection.
 
B

BobC

Here is the IP 2003 code that works.
<InfoPathEventHandler(MatchPath:="btn_ActAddtotop",
EventType:=InfoPathEventType.OnClick)> _
Public Sub btn_ActAddtotop_OnClick(ByVal e As DocActionEvent)

Dim nodeRowStart As IXMLDOMNode =
thisXDocument.DOM.selectSingleNode("/d:WorkOrders/d:Activity[1]")
If nodeRowStart Is Nothing Then
'thisXDocument.UI.Alert("nodeRowStart not valid")
Else

' insert the row insert before will place it on top.

thisXDocument.View.SelectNodes(nodeRowStart,
Type.Missing, Type.Missing) ' select the firs row in the list.
'thisXDocument.UI.Alert("Message to user..)

thisXDocument.View.ExecuteAction("xCollection::insertBefore",
"Activity_10") ' insert before the first row in the list.



End If
End Sub
 
S

S.Y.M. Wong-A-Ton

Try this link: http://msdn2.microsoft.com/en-us/library/aa944286(VS.80).aspx
---
S.Y.M. Wong-A-Ton


BobC said:
Here is the IP 2003 code that works.
<InfoPathEventHandler(MatchPath:="btn_ActAddtotop",
EventType:=InfoPathEventType.OnClick)> _
Public Sub btn_ActAddtotop_OnClick(ByVal e As DocActionEvent)

Dim nodeRowStart As IXMLDOMNode =
thisXDocument.DOM.selectSingleNode("/d:WorkOrders/d:Activity[1]")
If nodeRowStart Is Nothing Then
'thisXDocument.UI.Alert("nodeRowStart not valid")
Else

' insert the row insert before will place it on top.

thisXDocument.View.SelectNodes(nodeRowStart,
Type.Missing, Type.Missing) ' select the firs row in the list.
'thisXDocument.UI.Alert("Message to user..)

thisXDocument.View.ExecuteAction("xCollection::insertBefore",
"Activity_10") ' insert before the first row in the list.



End If
End Sub

I have code that works in InfoPath 2003:
Dim nodeRowStart As XPathNavigator =
e.Source.SelectSingleNode("/d:WorkOrders/d:Activity[1]",
NamespaceManager)
If nodeRowStart Is Nothing Then
System.Windows.Forms.MessageBox.Show("nodeRowStart not
valid")

Else

' insert the row insert before will place it on top.

Me.CurrentView.ExecuteAction("XCollectionInsertBefore",
"Activity_10")

End If

This no longer works in 2007.

The updated line

Me.CurrentView.ExecuteAction(ActionType.XCollectionInsertBefore,
"Activity_10")

The specified bstrAction value for the View.ExecuteAction call is not
applicable for the current selection.
 

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