VB2008 use more crystal report
leave my code
Private Sub frm_boletaIMp_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim rel As New rptBoletaImp
Dim formulaField As CrystalDecisions.CrystalReports.Engine.FormulaFiel dDefinition
Dim Formulafieldname As String
Dim logOnInfo As New CrystalDecisions.Shared.TableLogOnInfo()
Dim i As Integer
For i = 0 To rel.Database.Tables.Count - 1
logOnInfo.ConnectionInfo.ServerName = "SERVIDOR"
logOnInfo.ConnectionInfo.DatabaseName = "farmaciaccm"
logOnInfo.ConnectionInfo.UserID = "sa"
logOnInfo.ConnectionInfo.Password = "farmacia"
rel.Database.Tables.Item(i).ApplyLogOnInfo(logOnIn fo)
Next i
Formulafieldname = "IdBoleta"
formulaField = rel.DataDefinition.FormulaFields.Item(Formulafield name)
formulaField.Text = lblNumeroBoleta.Text
Formulafieldname = "TipoPago"
formulaField = rel.DataDefinition.FormulaFields.Item(Formulafield name)
formulaField.Text = "'" & lblTipoPago.Text & "'"
Formulafieldname = "Responsable"
formulaField = rel.DataDefinition.FormulaFields.Item(Formulafield name)
formulaField.Text = "'" & lbvendedor.Text & "'"
'configuracion de impresion
rel.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperEnvelope10
rel.PrintOptions.PrinterName = "Okidata ML 320 Turbo/D (IBM)"
' Con esta linea el printer toma el tipo de papel seteado en el Crystal Report
'rel.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Portrait 'Landscape '.Portrait
'imprime reporte directamente a la impresora
rel.PrintToPrinter(1, False, 0, 0)
crviewBoleta.ReportSource = rel
crviewBoleta.Visible = True
End Sub