GetSelectedNodes Method

Returns a reference to an XMLNodes collection that is populated with XML Document Object Model (DOM) nodes based on the current selection of items in a view.

expression.GetSelectedNodes() As XMLNodes

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

returns A reference to the XMLNodes collection.

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 no items are selected in a view, or if only text is selected, then the GetSelectedNodes method returns an empty collection.

Example

In the following example, the GetSelectedNodes method of the View object is used to set a reference to a collection of XML DOM nodes based on what is currently selected in the view. Then the code determines whether nodes were returned and, if they were, displays information about the first node found in the XMLNodes collection in a message box.

objXMLNodes = XDocument.View.GetSelectedNodes();

if (objXMLNodes.Count > 0)
{
   XDocument.UI.Alert(objXMLNodes(0).nodeName + "\n\n" + objXMLNodes(0).text);
}

Applies to | View Object