For my application I need to build report parameters programmatically. I have tried to follow the examples available but I cannot get the parameters to display as a dropdown list of values. The parameter does show up in the viewer but as a textbox. Below is the code that I am using to build my parameter -
Dim vals As New ArrayList |
<fill vals with strings of option values> |
Dim param As New ReportParameter |
param.Type = ReportParameterType.String |
param.UI.Visible = True |
param.UI.MultiValue = True |
param.Value = vals |
Me.ReportParameters.Add(param) |
This is wrapped in a routine that is called when the report is bound to it's data source. When I try to call the routine from the report's constructor it results in a run-time error.
My questions are:
1. How do I get my options to show up as a dropdown list?
2. When should this routine be called?
3. Is it possible to build it with a value/key pair rather than just a list of values?
----------------------------------------------------------------------------------------------------------------
Upon further investigation, either programmatic definition of parameters is not supported or the documentation is severely lacking because I have tried every example (there are just a few) that I can find and it either results in no parameter or a run-time error. For example, just trying to add a simple test parameter with the following code results in no parameter in the viewer:
Public Sub New() |
InitializeComponent() |
ReportParameters.Add("Test", ReportParameterType.String, "test") |
End Sub |
Thanks,
Dave