Jump to content
Xtreme .Net Talk

ccherry

Members
  • Posts

    1
  • Joined

  • Last visited

ccherry's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I'm using Crystal Reports 9 with VB.NET in which I'm using a form called, "frmShowReport." It is simply a form with a CrystalReportViewer control placed on it. I have set the ReportSource in that control to be crystalreport11, which is my .rpt file. The above function sets up the SQL statement inside of the report and then brings up the CrystalReportViewer. This all works great. The new form pops up and the report performs exactly as expected. My problem, however, comes when I try to print this report from the Viewer. I press the print button from the viewer, hit OK when the print options come up and it does send the report to my laser printer. This particular report I am printing is 3 pages long. The printer prints 3 pages, however, only a small portion of each page is printed to the paper, and also it�s printed in a weird position. It prints the upper-left hand ¼ of the report in the upper-right hand ¼ of the page, and the rest of the paper is blank. At first I think, �OK printer driver is messed up.� However, I can print from Word, Excel, and other programs just fine. Also, the report prints perfectly if I print a test version from the Crystal Reports report editor. So, it seems I�m missing some sort of setup command from inside of VB for the CRV or perhaps the crystal reports object itself. I just don�t have the foggiest idea what that command is. Here is the function that sets up my Crystal Reports report, and then shows the report to the user. Thanks in advance for your help. Private Sub tlbStatSum_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles tlbStatSum.ButtonClick Dim fReport As New frmShowReport() Dim selectionFormula As String Dim intStore As Integer Select Case tlbStatSum.Buttons.IndexOf(e.Button) Case 0 fReport.crystalReport11.SetParameterValue("varstore", 1) fReport.crystalReport11.SetParameterValue("varsummary", 1) fReport.Text = "Inventory Profitability Analysis - Printable Statistics Summary" Case 1 fReport.crystalReport11.SetParameterValue("varstore", 0) fReport.crystalReport11.SetParameterValue("varsummary", 0) fReport.Text = "Inventory Profitability Analysis - Detailed Report" Case Else Return End Select fIstat.txtVend.Text = fIstat.txtVend.Text.ToUpper fIstat.txtCatno.Text = fIstat.txtCatno.Text.ToUpper selectionFormula = vbNullString With fReport .CrystalReportViewer1.LogOnInfo(0).ConnectionInfo.Password = "MyPassword" .crystalReport11.PrintOptions.PaperOrientation = CrystalDecisions.[shared].PaperOrientation.Landscape .crystalReport11.SetParameterValue("vend", fIstat.txtVend.Text) .crystalReport11.SetParameterValue("catno", fIstat.txtCatno.Text) If fIstat.cmbStore.SelectedValue <> -1 Then intStore = fIstat.cmbStore.SelectedValue selectionFormula = "({COMMAND.STORE} = " & intStore & ")" .crystalReport11.SetParameterValue("varstore", intStore) End If If fIstat.chkPrimItemSw.Checked = True Then If selectionFormula <> vbNullString Then selectionFormula = selectionFormula & " and " End If selectionFormula = selectionFormula & "({COMMAND.PRIMARY} = ""P"")" End If If fIstat.chkSpecSw.Checked = True Then If selectionFormula <> vbNullString Then selectionFormula = selectionFormula & " and " End If selectionFormula = selectionFormula & "({COMMAND.TYPE}<>""X"")" End If .CrystalReportViewer1.SelectionFormula = selectionFormula .CrystalReportViewer1.ShowRefreshButton = False .Show() End With End Sub
×
×
  • Create New...