Share via


ReportObjects.Item Property (String)

Gets the object with the specified name. In C#, this property is the indexer for the ReportObject class.

Namespace CrystalDecisions.CrystalReports.Engine Assembly CrystalDecisions.CrystalReports.Engine (CrystalDecisions.CrystalReports.Engine.dll)

Syntax

'Declaration

Public Overrideable ReadOnly Property Item ( _
    ByVal fieldName As String _ 
) As CrystalDecisions.CrystalReports.Engine.ReportObject
public virtual CrystalDecisions.CrystalReports.Engine.ReportObject this [
    string fieldName
]{get;}

Parameters

  • fieldName

Property Value

The value in the collection with the specified name.

Remarks

This property allows you to access a specific item in the collection. The item is referenced by the object name, such as "object1".

The property name Item does not exist for C#. To access an item in a collection using C#, use the syntax: collection["object1"].

Example

This example shows how to set the border line styles to a single style, update the background and border colors, and change the drop shadow setting.

'Declaration

  Private Sub UpdateBlobFieldObjectBorder(ByVal myReportDocument As ReportDocument, ByVal reportObjectName As String, ByVal myLineStyle As LineStyle, ByVal backgroundColor As Color, ByVal borderColor As Color)
    Dim myReportObject As ReportObject = myReportDocument.ReportDefinition.ReportObjects.Item(reportObjectName)
    If myReportObject.Kind = ReportObjectKind.BlobFieldObject Then
      Dim myBlobFieldObject As BlobFieldObject = myReportObject
      Dim myBorder As Border = myBlobFieldObject.Border
      myBorder.BackgroundColor = backgroundColor
      myBorder.BorderColor = borderColor
      myBorder.BottomLineStyle = myLineStyle
      myBorder.LeftLineStyle = myLineStyle
      myBorder.RightLineStyle = myLineStyle
      myBorder.TopLineStyle = myLineStyle
      myBorder.HasDropShadow = True
    End If
  End Sub
  private void UpdateBlobFieldObjectBorder(ReportDocument reportDocument, String reportObjectName, LineStyle lineStyle, Color backgroundColor, Color borderColor)
  {
    ReportObject reportObject = reportDocument.ReportDefinition.ReportObjects[reportObjectName];
    if (reportObject.Kind == ReportObjectKind.BlobFieldObject)
    {
      BlobFieldObject blobFieldObject = (BlobFieldObject)reportObject;
      Border border = blobFieldObject.Border;

      border.BackgroundColor = backgroundColor;
      border.BorderColor = borderColor;
      border.BottomLineStyle = lineStyle;
      border.LeftLineStyle = lineStyle;
      border.RightLineStyle = lineStyle;
      border.TopLineStyle = lineStyle;
      border.HasDropShadow = false;
    }
  }

Version Information

Crystal Reports Basic for Visual Studio 2008

Supported since: Crystal Reports for Visual Studio .NET 2002

See Also

Reference

ReportObjects Class
ReportObjects Members
CrystalDecisions.CrystalReports.Engine Namespace