This document is archived and information here might be outdated.  Recommended version.


IPageLayoutControlDefault.FindElementByName Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Controls > ESRI ArcGIS Controls > Interfaces > IP > IPageLayoutControlDefault Interface > IPageLayoutControlDefault.FindElementByName Method
ArcGIS Developer Help

IPageLayoutControlDefault.FindElementByName Method

Find the first element with the supplied name, supply an occurrence parameter to find the second, third and so on.

[Visual Basic .NET]
Public Function FindElementByName ( _
    ByVal Name As String, _
    [ByVal Occurence As Integer] _
) As IElement
[C#]
public IElement FindElementByName (
    string Name,
    int Occurence
);
[C++]
HRESULT FindElementByName(
  BSTR Name,
  long Occurence
);
[C++]
Parameters
Name [in]

Name is a parameter of type BSTR Occurence [in, optional, defaultvalue()]
Occurence is a parameter of type long

Product Availability

Available with ArcGIS Engine.

Description

If an empty string is supplied then any elements with no name are found. By default new elements are created with no name. To give an element a name so it can easily be found use one of the following methods: either supply a name string when using the AddElement method, or implement the IElementProperties interface.

[C#]
//Supply a name string in the AddElement method
axPageLayoutControl1.AddElement(myElement,null ,null, "myElementName",-1);

//Query Interface for IElementProperties interface
IElementProperties elementProperties = (IElementProperties) myElement;
elementProperties.Name = "myElementName";
axPageLayoutControl1.AddElement(myElement,null,null,null,-1);
[Visual Basic .NET]
'Supply a name string in the AddElement method
AxPageLayoutControl1.AddElement(myElement, , , "myElementName")

'Query Interface for IElementProperties interface
Dim pElementProperties As IElementProperties
pElementProperties = myElement
pElementProperties.Name = "myElementName"
AxPageLayoutControl1.AddElement(myElement)

See Also

IPageLayoutControlDefault Interface