xtrareports-devexpress-dot-xtrareports-dot-ui-be345f17.md
Provides data for the CalculatedField.GetValue event.
Namespace : DevExpress.XtraReports.UI
Assembly : DevExpress.XtraReports.v25.2.dll
NuGet Package : DevExpress.Reporting.Core
public class GetValueEventArgs :
EventArgs,
IDisposable
Public Class GetValueEventArgs
Inherits EventArgs
Implements IDisposable
GetValueEventArgs is the data class for the following events:
The CalculatedField.GetValue event occurs when a calculated field obtains its value, enabling you to return a custom value for this calculated field. The GetValueEventArgs class introduces the GetValueEventArgs.Value property, which accepts the final calculated value for a calculated field, and the GetValueEventArgs.Row and GetValueEventArgs.Report properties, which enable you to obtain any information required to calculate a value for a calculated field.
Note
GetValueEventArgs objects are automatically created, initialized and passed to the CalculatedField.GetValue event handlers.
The report created in this example is bound to the “Orders” table of the sample Northwind database.
To sort records by days of the week at runtime, do the following.
using System;
using System.Data;
using System.Windows.Forms;
using DevExpress.XtraReports.UI;
// ...
private void calculatedField1_GetValue(object sender, GetValueEventArgs e) {
object columnValue = e.GetColumnValue("OrderDate");
e.Value = (int)((DateTime)columnValue).DayOfWeek;
}
private void hdrLabel_BeforePrint(object sender, System.ComponentModel.EventArgs e) {
hdrLabel.Text = ((DayOfWeek)this.GetCurrentColumnValue(this.calculatedField1.Name)).ToString();
}
Imports System
Imports System.Data
Imports System.Windows.Forms
Imports DevExpress.XtraReports.UI
' ...
Private Sub calculatedField1_GetValue(ByVal sender As Object, _
ByVal e As GetValueEventArgs) Handles calculatedField1.GetValue
Dim columnValue As Object = e.GetColumnValue("OrderDate")
e.Value = CInt(Fix((CDate(columnValue)).DayOfWeek))
End Sub
Private Sub hdrLabel_BeforePrint(ByVal sender As Object, _
ByVal e As System.ComponentModel.EventArgs) Handles hdrLabel.BeforePrint
hdrLabel.Text = (CType(Me.GetCurrentColumnValue(Me.calculatedField1.Name), _
DayOfWeek)).ToString()
End Sub
Object EventArgs GetValueEventArgs
See Also