The requested page is not available for the requested platform. You are viewing the content for Default platform.

XRControlCollection.Contains(XRControl) Method

Determines whether the specified control is a member of the collection.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v18.2.dll

Declaration

public bool Contains(
    XRControl item
)
Public Function Contains(
    item As XRControl
) As Boolean

Parameters

Name Type Description
item XRControl

The XRControl object to locate in the collection.

Returns

Type Description
Boolean

true if the control is a member of the collection; otherwise, false.

Remarks

This method enables you to determine whether the specified control is a member of the collection before attempting to perform operations on the control. This method can be used to confirm that the control has been added to or is still a member of the collection.

Examples

The following example shows two methods that use the XRControlCollection.Add, XRControlCollection.Remove and XRControlCollection.Contains methods of the XRControlCollection class. The first method adds a control to the control collection of the XRPanel object at the specified location. The second method checks if the specified control belongs to the specified collection, and if it does, it removes the control from the collection.

using System.Drawing;
using DevExpress.XtraReports.UI;
// ...

public void AddControl(XRPanel panel, XRControl item, int x, int y) {
    // Add a control to the collection.
    panel.Controls.Add(item);

    // Set the control's location within the panel.
    item.Location = new Point(x, y);
}

public void RemoveControl(XRPanel panel, XRControl item) {
    // Check if the control belongs to the collection.
    if(panel.Controls.Contains(item))

        // Remove the control from the collection.
        panel.Controls.Remove(item);
}
See Also