You can use conditions in the Format event to control when the report's Detail section is shown.
The following example shows what the code for the method looks like. This code assumes that your report has the following fields:
To 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 |
To 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; } |