If a have a lable called: lblWarning. I'd like to display it (Visible = True) when the detail band does not have any records. The label is in the group footer.
This event is attached to the report itself (in my example, it's named XtraReport1). GetCurrentRow()
is a method on XtraReportBase
that returns the current data from the primary report binding source. If data does not exist, it returns null.
private void XtraReport1_BeforePrint(object sender, PrintEventArgs e)
{
bool noDataFound = GetCurrentRow() == null;
lblWarning.Visible = noDataFound;
}
The same handler in VB:
Private Sub XtraReport1_BeforePrint(ByVal sender As System.Object, ByVal e As PrintEventArgs) Handles MyBase.BeforePrint
Dim noDataFound As Boolean = GetCurrentRow() Is Nothing
lblWarning.Visible = noDataFound
End Sub