Show All

# SelectText Method

Selects the text contained in an editable field that is bound to the specified XML Document Object Model (DOM) node.

expression.SelectText(ByRef pxnField As XMLDOMNode, [ByVal varViewContext As Variant)

expression Required. An expression that returns a reference to the View object.

pxnField Required XMLDOMNode. The XML DOM node.

varViewContext Optional Variant. The ID of the control that is used for the context, which is an element with the specified view context of `xd:CtrlId`.

## Security Level

2: 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.

## Remarks

If a view context is specified, then the editable field that is to be selected must be within that context.

If there are more than one set of view elements which map to the same specified XML DOM node, within the given view context, then the SelectText method will return an error. In addition, if any of the arguments to the SelectText method are null or are not exposed in the view, then the SelectText method will also return an error.

## Example

In the following example, the SelectText method of the View object is used to select a field that is bound to an XML DOM node:

    var objXMLNode;

    objXMLNode = XDocument.DOM.selectSingleNode("/employees/employee/name");
    XDocument.View.SelectText(objXMLNode);

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp