METHOD How to set a Local Report Parameter

 

They said it could not be done.
But here is the code to set a Local Report Parameter at runtime

”’ <summary>
”’ METHOD How to set Report Parameter
”’ </summary>
”’ <param name="MyReportViewer"></param>
”’ <param name="sParameterName"></param>
”’ <param name="sParameterText"></param>
”’ <remarks></remarks>

Private Sub SetLocalReportParameter(ByVal MyReportViewer As Microsoft.Reporting.WinForms.ReportViewer, ByVal sParameterName As String, ByVal sParameterText As String)

Try
Dim rp As New ReportParameter(sParameterName, sParameterText)
Dim rpP() As ReportParameter = {rp}
With MyReportViewer
.LocalReport.SetParameters(rpP)
.RefreshReport()
End With

Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

End Sub

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: