打印Rdlc报告而不显示预览vb.net

时间:2016-02-08 13:40:01

标签: vb.net rdlc

我制作了一个打印发票的项目,但是我试图打印我的报告而不在reportviewer中显示打印预览,有人可以帮我吗? 这是我用它打印的代码:

 Dim ds As New DataSet1
    Dim dt As DataTable = ds.Tables(0)

    If Cn.State = 1 Then Cn.Close()
    If Rs.State = 1 Then Rs.Close()
    Cn.Open(constr)
    Rs.Open("Select * From tbltemp", Cn, 1, 2)
    For x = 0 To Rs.RecordCount - 1
        Dim r As DataRow = dt.NewRow()
        r("itemcode") = Rs.Fields("itemcode").Value
        r("itemname") = Rs.Fields("itemname").Value
        r("itemunit") = Rs.Fields("itemunit").Value
        r("itemsize") = Rs.Fields("itemsize").Value
        r("itemqnt") = Rs.Fields("itemqnt").Value
        r("reqdate") = Format(Rs.Fields("reqdate").Value, "dd/MM/yyyy")
        r("ava1") = Rs.Fields("ava1").Value
        r("ava2") = Rs.Fields("ava2").Value
        r("rejust") = Rs.Fields("rejust").Value
        Rs.MoveNext()
        dt.Rows.Add(r)
    Next
    Rs.MoveFirst()

    frmreport.ReportViewer1.LocalReport.DataSources.Clear()
    frmreport.ReportViewer1.LocalReport.DataSources.Add(New   ReportDataSource("DataSet1", ds.Tables(0)))      frmreport.ReportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout)
    frmreport.ReportViewer1.RefreshReport()

     Cn.Close()
     frmreport.Show()

0 个答案:

没有答案