Depending on a value in a field on the report, I want to decide whether to display the entire row or not. I know that I could mark the Visible property on the Field/TextBox control to false, but that won't hide the entire row (e.g. such as the Detail Section). I am using VB.NET 2.0 and ActiveReports 4. Any pointers?
Asked
Active
Viewed 1,131 times
1 Answers
2
By "row" I'm assuming you mean a Section. You can hide a section by setting the Visible property of the Section object to false. You could use code something like the following.
Note: This code needs to be in the Format event of the Section that you're hiding.
If Me.txtReorderLevel.Value = 0 And Me.txtDiscontinued.Value = False Then
Me.Detail1.Visible = True ' Detail1 is a reference to the Section to hide
Else
Me.Detail.Visible = False
End If
There is also a how to topic in the help that describes this scenario. However, this is from the newest version of ActiveReports which also includes page-layout reports so the namespaces are slightly different. The code for Section reports is the same however.

Scott Willeke
- 8,884
- 1
- 40
- 52
-
I am doing similarly. in debug, the rendering is just fine whereas the result is not the same after I publish the code. – DHAR Apr 29 '13 at 20:20
-
@DHAR You'll need to provide more information. Apparently the condition (if statement) is going a different path when published. Why? I suggest you add some debug statements and log the results to find the culprit there. Also, make absolutely sure that the code above is in the Format event of the section being hidden. This is very important and very likely to cause intermittent issues if you get it wrong. – Scott Willeke Apr 29 '13 at 22:47
-
1Thanks Scott. Its actually data issue; while debugging I made a wide date range is available for testing. wherein after publishing, I don't control the date :). Somehow we both thought the same way while solving this. Thanks for your pointers. – DHAR Apr 30 '13 at 00:07
-
Whats the difference between Detail.Visible false and LayoutAction = LayoutAction.NextRecord? if the intention is to skip a row conditionally.. – DHAR Apr 30 '13 at 15:57