private void tmrZoom_Tick(System.Object eventSender, System.EventArgs eventArgs) { // ERROR: Not supported in C#: OnErrorStatement tmrZoom.Enabled = false; CRViewer1.Zoom(120); }
void BindData() { DataSet ds = new DataSet(); ds = bll.GetListByKeyuanPrint(); CRSource1.ReportDocument.Load(Server.MapPath("CrystalReport1.rpt")); CRSource1.ReportDocument.SetDataSource(ds.Tables[0]); CRSource1.DataBind(); CRViewer1.ReportSource = CRSource1; CRViewer1.DataBind(); }
void BindData() { if (Session["UserID"] != null) { string userid = Session["UserID"].ToString(); string Unit = UserBll.GetUnitByUserID(userid); DataSet ds = new DataSet(); ds = bll.GetListByMishuPrint(Unit); CRSource1.ReportDocument.Load(Server.MapPath("CrystalReport2.rpt")); CRSource1.ReportDocument.SetDataSource(ds.Tables[0]); CRSource1.DataBind(); CRViewer1.ReportSource = CRSource1; CRViewer1.DataBind(); } else { Response.Redirect("login.aspx"); } }
private void cmdPrint_Click(System.Object eventSender, System.EventArgs eventArgs) { // ERROR: Not supported in C#: OnErrorStatement //If sMode = "1" Then // 'old code to print report // CRViewer1.PrintReport // DoEvents // cmdPrint.SetFocus // Exit Sub // 'old code to print report //Else System.Windows.Forms.Application.DoEvents(); //Dim cOrientation As CRAXDRT.CRPaperOrientation //Dim cOriendation As CrystalDecisions.CrystalReports.Engine.PrintOptions //Dim cSize As CRAXDRT.CRPaperSize //cOrientation = mReport.PaperOrientation //cSize = mReport.PaperSize //Printer.DeviceName //UPGRADE_WARNING: CommonDialog variable was not upgraded Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="671167DC-EA81-475D-B690-7A40C7BF4A23"' var _with1 = cdbPrinterPrint; //CancelError = True 'Abort print when user clicks on cancels //.PrinterDefault = True 'Use user selection to change printer default. _with1.PrinterSettings.MinimumPage = 1; // Guess! CRViewer1.ShowLastPage(); System.Windows.Forms.Application.DoEvents(); _with1.PrinterSettings.MaximumPage = CRViewer1.GetCurrentPageNumber; //1 System.Windows.Forms.Application.DoEvents(); _with1.PrinterSettings.ToPage = CRViewer1.GetCurrentPageNumber; //1 CRViewer1.ShowFirstPage(); _with1.PrinterSettings.FromPage = CRViewer1.GetCurrentPageNumber; //1 System.Windows.Forms.Application.DoEvents(); _with1.ShowDialog(); System.Windows.Forms.Application.DoEvents(); //Report.VerifyOnEveryPrint = True //mReport.selectPrinter Printer.DriverName, Printer.DeviceName, Printer.Port mReport.PrintToPrinter(false, false, cdbPrinterPrint.PrinterSettings.FromPage, cdbPrinterPrint.PrinterSettings.ToPage); //mReport.PrintOut(False, cdbPrinterPrint.PrinterSettings.Copies, , cdbPrinterPrint.PrinterSettings.FromPage, cdbPrinterPrint.PrinterSettings.ToPage) //With mReport // .selectPrinter Printer.DriverName, Printer.DeviceName, Printer.Port // '.PaperOrientation = cOrientation // '.PaperSize = cSize // 'If cdbPrinter.Flags = cdlPDAllPages Then // ' .PrintOut False, cdbPrinter.Copies ', False, cdbPrinter.FromPage // 'ElseIf cdbPrinter.Flags = cdlPDPageNums Then // ' .PrintOut False, cdbPrinter.Copies, False, cdbPrinter.FromPage, cdbPrinter.ToPage // 'Else // .PrintOut False, cdbPrinter.Copies, , cdbPrinter.FromPage, cdbPrinter.ToPage // 'End If //End With System.Windows.Forms.Application.DoEvents(); cmdPrint.Focus(); //End If return; printError: if (Err().Number == MsgBoxResult.Cancel) { return; } else if (Err().Number == 32755) { return; } else if (Strings.InStr(1, Err().Description, "Cancel")) { return; } else { //MsgBox Err.Number & Err.Description // ERROR: Not supported in C#: ResumeStatement } //If cdbPrinter.CancelError Then Exit Sub }