xtrareports-devexpress-dot-xtrareports-dot-ui-dot-calculatedfield-3369a7ed.md
Gets or sets the calculated field‘s name.
Namespace : DevExpress.XtraReports.UI
Assembly : DevExpress.XtraReports.v25.2.dll
NuGet Package : DevExpress.Reporting.Core
[Browsable(false)]
[DefaultValue("")]
public string Name { get; set; }
<DefaultValue("")>
<Browsable(False)>
Public Property Name As String
| Type | Default | Description |
|---|---|---|
| String | String.Empty |
A String that specifies the calculated field’s name.
|
You can use the Name property at runtime to evaluate an object by its name rather than type or programmatic name. The Name property returns a String value and can be evaluated in case-style logic statements ( switch statement in C#, Select statement in Visual Basic).
Note
To avoid invalid report serialization, the Name property value should not contain any reserved .NET words, library names or the XtraReport class’s property names ( DataSource , Version , etc.)
To specify a calculated field’s display name (which appears in the Field List), use the CalculatedField.DisplayName property.
See Calculated Fields for more information.
Refer to Create a Calculated Field (Runtime Sample) for a code example.
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Name property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
reporting-winforms-calculated-field-runtime/CS/UsingCalculatedFields/Form1.cs#L27
calcField.DisplayName = "Calculated Field";
calcField.Name = "myField";
calcField.Expression = "[UnitPrice] * [UnitsInStock]";
reporting-winforms-calculated-field-runtime/VB/UsingCalculatedFields/Form1.vb#L30
calcField.DisplayName = "Calculated Field"
calcField.Name = "myField"
calcField.Expression = "[UnitPrice] * [UnitsInStock]"
See Also