Hi
i am using following code in VB.net Crystal Report for .Net
how can i implement to print report directly on printer instead of showing in the Control
Thanks
Nouman
Dim intTables, intParamCount As Integer
' Objects used to set the proper database connection information
Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo
Dim pvCollection As New CrystalDecisions.Shared.ParameterValues()
Dim pdvParameter As New CrystalDecisions.Shared.ParameterDiscreteValue()
' Create a report document instance to hold the report
Dim rptDocument As New ReportDocument()
Try
Select Case strReportName
Case Is = "A" '7501 Report
' Load the report
'rptExpensiveProducts.Load("..\Reports\rptCustomEntry.rpt"
rptDocument.Load("..\Reports\rptCustomsEntryNew.rpt"
For Each tbCurrent In rptDocument.Database.Tables
tliCurrent = tbCurrent.LogOnInfo
With tliCurrent.ConnectionInfo
.ServerName = ReportServerName
.UserID = DBUserName
.Password = Password
.DatabaseName = ReportDatabaseName
End With
tbCurrent.ApplyLogOnInfo(tliCurrent)
Next tbCurrent
pdvParameter.Value = ParamCollection.Item(1)
' Add it to the parameter collection.
pvCollection.Add(pdvParameter)
rptDocument.DataDefinition.ParameterFields("@P_CustomEntryID".ApplyCurrentValues(pvCollection)
pvCollection = New CrystalDecisions.Shared.ParameterValues()
pdvParameter = New CrystalDecisions.Shared.ParameterDiscreteValue()
pdvParameter.Value = ParamCollection.Item(2)
' Add it to the parameter collection.
pvCollection.Add(pdvParameter)
' Apply the current parameter values.
rptDocument.DataDefinition.ParameterFields("@P_CustomEntryShipmentID".ApplyCurrentValues(pvCollection)
'rptDocument.SetDataSource(RecordsetDataSet)
rptDocument.Database.Tables(0).SetDataSource(RecordsetDataSet.Tables(0))
rptDocument.Database.Tables(1).SetDataSource(RecordsetDataSet.Tables(1))
End Select
' Set the report source for the crystal reports
' viewer to the report instance.
'rptDocument.SetDataSource(RecordsetDataSet)
rptViewer.ReportSource = rptDocument
' Zoom viewer to fit to the whole page so the user can see the report
rptViewer.Zoom(150%)
i am using following code in VB.net Crystal Report for .Net
how can i implement to print report directly on printer instead of showing in the Control
Thanks
Nouman
Dim intTables, intParamCount As Integer
' Objects used to set the proper database connection information
Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo
Dim pvCollection As New CrystalDecisions.Shared.ParameterValues()
Dim pdvParameter As New CrystalDecisions.Shared.ParameterDiscreteValue()
' Create a report document instance to hold the report
Dim rptDocument As New ReportDocument()
Try
Select Case strReportName
Case Is = "A" '7501 Report
' Load the report
'rptExpensiveProducts.Load("..\Reports\rptCustomEntry.rpt"
rptDocument.Load("..\Reports\rptCustomsEntryNew.rpt"
For Each tbCurrent In rptDocument.Database.Tables
tliCurrent = tbCurrent.LogOnInfo
With tliCurrent.ConnectionInfo
.ServerName = ReportServerName
.UserID = DBUserName
.Password = Password
.DatabaseName = ReportDatabaseName
End With
tbCurrent.ApplyLogOnInfo(tliCurrent)
Next tbCurrent
pdvParameter.Value = ParamCollection.Item(1)
' Add it to the parameter collection.
pvCollection.Add(pdvParameter)
rptDocument.DataDefinition.ParameterFields("@P_CustomEntryID".ApplyCurrentValues(pvCollection)
pvCollection = New CrystalDecisions.Shared.ParameterValues()
pdvParameter = New CrystalDecisions.Shared.ParameterDiscreteValue()
pdvParameter.Value = ParamCollection.Item(2)
' Add it to the parameter collection.
pvCollection.Add(pdvParameter)
' Apply the current parameter values.
rptDocument.DataDefinition.ParameterFields("@P_CustomEntryShipmentID".ApplyCurrentValues(pvCollection)
'rptDocument.SetDataSource(RecordsetDataSet)
rptDocument.Database.Tables(0).SetDataSource(RecordsetDataSet.Tables(0))
rptDocument.Database.Tables(1).SetDataSource(RecordsetDataSet.Tables(1))
End Select
' Set the report source for the crystal reports
' viewer to the report instance.
'rptDocument.SetDataSource(RecordsetDataSet)
rptViewer.ReportSource = rptDocument
' Zoom viewer to fit to the whole page so the user can see the report
rptViewer.Zoom(150%)