ActiveReports 6 Online Help
Conditionally Show or Hide Details
See Also Send comments on this topic.
ActiveReports 6 > ActiveReports User Guide > How To > Conditionally Show or Hide Details

Glossary Item Box

You can use conditions in the Format event to control when the report's Detail section is shown.

To add code to hide the detail section

  1. Double-click the detail section of the report to create an event-handling method for the Detail Format event.
  2. Add code to the handler to hide the detail section if the product is discontinued.

The following example shows what the code for the method looks like. This code assumes that your report has the following fields:

ShowTo write the code in Visual Basic.NET

Visual Basic.NET code. Paste INSIDE the Detail Format event. Copy Code
If Me.txtReorderLevel.Value = 0 And Me.txtDiscontinued.Value = False Then
    Me.Detail1.Visible = True
    Me.txtDiscontinued.Text = ""
    Me.txtReorderLevel.Text = "Need to Reorder"
    Me.txtReorderLevel.ForeColor = System.Drawing.Color.DarkRed
Else
    Me.Detail.Visible = False
End If

ShowTo write the code in C#

C# code. Paste INSIDE the Detail Format event. Copy Code
if(txtReorderLevel.Value == 0 && txtDiscontinued.Text == False)
{
    this.detail.Visible = true;
    this.txtDiscontinued.Text = "";
    this.txtReorderLevel.Text = "Need to Reorder";
    this.txtReorderLevel.ForeColor = System.Drawing.Color.DarkRed;
}
else
{
    this.detail.Visible = False;
}

See Also