共用方式為


LocalReport.SetParameters 方法 (IEnumerable<ReportParameter>)

設定本機報表的報表參數屬性。

命名空間:  Microsoft.Reporting.WinForms
組件:  Microsoft.ReportViewer.WinForms (在 Microsoft.ReportViewer.WinForms.dll 中)

語法

'宣告
Public Overrides Sub SetParameters ( _
    parameters As IEnumerable(Of ReportParameter) _
)
public override void SetParameters(
    IEnumerable<ReportParameter> parameters
)
public:
virtual void SetParameters(
    IEnumerable<ReportParameter^>^ parameters
) override
abstract SetParameters : 
        parameters:IEnumerable<ReportParameter> -> unit 
override SetParameters : 
        parameters:IEnumerable<ReportParameter> -> unit 
public override function SetParameters(
    parameters : IEnumerable<ReportParameter>
)

參數

備註

The parameters specified for the SetParameters method must be defined in the original report definition.

範例

The following code example shows a report parameter being set to the value of a check box on a form.

private void SetReportParameters() {
   ReportParameter p1 = new 
      ReportParameter("ShowDescriptions", checkBox1.Checked.ToString());
   ReportParameter p2 = new 
      ReportParameter("ShowTitle", checkBox2.Checked.ToString());
   this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p1, p2 });
}
Private Sub SetReportParameters()
   Dim p1 As New ReportParameter("ShowDescriptions", _
     CheckBox1.Checked.ToString())
   Dim p2 As New ReportParameter("ShowTitle", _
     CheckBox2.Checked.ToString())
   ReportViewer1.LocalReport.SetParameters(New ReportParameter() {p1, p2})
End Sub

請參閱

參考

LocalReport 類別

SetParameters 多載

Microsoft.Reporting.WinForms 命名空間