In a section report, green bar printouts can be created by setting alternate shades or background color in the report's detail section in the Format event. The following steps demonstrate how to create a Green Bar report.
To write the code in Visual Basic.NET
Visual Basic.NET code. Paste JUST ABOVE the Detail Format event. |
Copy Code
|
---|---|
Dim color As Boolean |
Visual Basic.NET code. Paste INSIDE the Detail Format event. |
Copy Code
|
---|---|
If color = True Then Me.Detail1.BackColor = System.Drawing.Color.DarkSeaGreen color = False Else Me.Detail1.BackColor = System.Drawing.Color.Transparent color = True End If |
To write the code in C#
C# code. Paste JUST ABOVE the Detail Format event. |
Copy Code
|
---|---|
bool color; |
C# code. Paste INSIDE the Detail Format event. |
Copy Code
|
---|---|
if(color) { this.detail.BackColor = System.Drawing.Color.DarkSeaGreen; color = false; } else { this.detail.BackColor = System.Drawing.Color.Transparent; color = true; } |
The following image shows a Green Bar report alternating between Transparent and Dark Sea Green backgrounds: