如果有一个标签叫做:lblWarning。当详细信息带没有任何记录时,我想显示它(Visible = True)。标签位于组页脚中。
问问题
8293 次
2 回答
1
此事件附加到报告本身(在我的示例中,它被命名为 XtraReport1)。 GetCurrentRow()
是一种XtraReportBase
从主报表绑定源返回当前数据的方法。如果数据不存在,则返回 null。
private void XtraReport1_BeforePrint(object sender, PrintEventArgs e)
{
bool noDataFound = GetCurrentRow() == null;
lblWarning.Visible = noDataFound;
}
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
于 2010-02-11T15:30:48.383 回答
0
目前不在我的开发机器前面,但是这样的事情可能会起作用
Dim HadRecords As Boolean = False
Private Sub GroupFooter1_BeforePrint(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintEventArgs) Handles GroupFooter1.BeforePrint
If HadRecords = False Then
lblWarning.visible = True
Else
lblWarning.visible = False
HadRecords = False ' reset the flag '
End If
End Sub
Private Sub Detail_BeforePrint(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintEventArgs) Handles Detail.BeforePrint
HadRecords = True ' set the flag '
End Sub
于 2009-12-03T03:11:13.700 回答