I have a WinForms report that uses a boolean-type parameter (flgShowAreaPlants). In the RDLC I've added the parameter and set its data type to "Boolean".
I add the parameter to the ReportViewer in the Load event of the report's form.
The following code does not work...
Code:
myParam = New ReportParameter("flgShowAreaPlants", flgShowAreaPlants)
ReportViewer1.LocalReport.SetParameters(myParam)
The Error List window shows the following error.
Error BC30518 Overload resolution failed because no accessible 'New' can be called with these arguments:
'Public Overloads Sub New(name As String, value As String)': Option Strict On disallows implicit conversions from 'Boolean' to 'String'.
'Public Overloads Sub New(name As String, values As String())': Value of type 'Boolean' cannot be converted to 'String()'.
This code works...
Code:
myParam = New ReportParameter("flgShowAreaPlants", CStr(flgShowAreaPlants))
ReportViewer1.LocalReport.SetParameters(myParam)
Looking at the ReportParameter class, I see the 5 overload methods and 2 of them have a "visible As Boolean" property.
Code:
Namespace Microsoft.Reporting.WinForms
Public NotInheritable Class ReportParameter
Public Sub New()
Public Sub New(name As String)
Public Sub New(name As String, value As String)
Public Sub New(name As String, values() As String)
Public Sub New(name As String, value As String, visible As Boolean)
Public Sub New(name As String, values() As String, visible As Boolean)
Public Property Name As String
Public Property Values As StringCollection
Public Property Visible As Boolean
End Class
Using the 4th overload method works also...
Code:
myParam = New ReportParameter("flgShowAreaPlants", CStr(flgShowAreaPlants), True)
ReportViewer1.LocalReport.SetParameters(myParam)
The only documentation on the "visible As Boolean" property that I've found is not much help.
https://learn.microsoft.com/en-us/pr...51861(v=vs.90)
Why must a Boolean-type parameter be added to the ReportViewer as string-type? What is the purpose of the "visible As Boolean" property?
Looking for some help to understand what is going on.