Share via


View.SelectText Method (XPathNavigator) (Microsoft.Office.InfoPath)

Selects the text contained in an editable control that is bound to the node specified by the XPathNavigator object passed to this method.

Namespace: Microsoft.Office.InfoPath
Assembly: Microsoft.Office.InfoPath (in microsoft.office.infopath.dll)

Syntax

'Declaration
Public MustOverride Sub SelectText ( _
    xmlNode As XPathNavigator _
)
'Usage
Dim instance As View
Dim xmlNode As XPathNavigator

instance.SelectText(xmlNode)
public abstract void SelectText (
    XPathNavigator xmlNode
)

Parameters

Exceptions

Exception type Condition

InvalidOperationException

The SelectText method was called from an event handler for the Loading event.

ArgumentNullException

The parameter passed to this method is null.

ArgumentException

The parameter passed to this method isnot valid. For example, it is of the wrong type or format.

Remarks

If an specified text is bound to more than one control in the view, using this SelectText method will raise an exception. To avoid this, you must use the SelectText(XPathNavigator,String) method which allows you to specify the ViewContext identifier of the control that contains the text you want to select.

In addition, if the argument to the SelectText method is null or is not exposed in the view, then the SelectText method will also raise an exception.

This member can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

This type or member can be accessed only from code running in forms opened in Microsoft Office InfoPath 2007.

Example

In the following example, the SelectText(xmlNode) method is used to select the text in field1.

// Create XPathNavigator and select field.
XPathNavigator textNode = 
   CreateNavigator().SelectSingleNode(
   "/my:myFields/my:field1", NamespaceManager);

// Select text in specified field.
CurrentView.SelectText(textNode);
' Create XPathNavigator and select field.
Dim textNode As XPathNavigator = _
   CreateNavigator().SelectSingleNode( _
   "/my:myFields/my:field1", NamespaceManager)

' Select text in specified field.
CurrentView.SelectText(textNode)

See Also

Reference

View Class
View Members
Microsoft.Office.InfoPath Namespace