Private Sub txt_bc_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txt_bc.KeyPress
If e.KeyChar = Chr(13) Then '1.1
Try
Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
rpt.Load(Application.StartupPath & ("\CrystalReport1.rpt"))
rpt.SetDatabaseLogon(username, password)
rpt.SetParameterValue("pull_no", txt_bc.ToString())
CrystalReportViewer1.ReportSource = rpt
rpt.PrintToPrinter(1, True, 0, 0)
Catch ex As Exception
Process.Start("C:\Program Files\STARTEXE\CALLEXEPRINT.exe")
Application.Exit()
End Try
Dim rep As New ReportDocument
End If
End Sub
Private Sub cmbcryReport1_Click()
Dim S As String, iFM As String
S = App.Path & "\Workplace.rpt"
iFM = ""
With CrystalReport1
.ReportFileName = S
.Connect = "PWD=" & PWD_
iFM = "{savedocter.Workplace_lab} = '" & Trim(cmbWorkplace_lab.Text) & " ' "
.ReplaceSelectionFormula (iFM)
.Action = 1
.PageZoom (1)
End With
End Sub
vb.net 2008
Dim ParamName As New ParameterDiscreteValue
ParamName.Value = Check_doc
Dim ParamFld As New ParameterField
ParamFld.ParameterFieldName = "Check_doc"
ParamFld.CurrentValues.Add(ParamName)
Dim ParamField As New ParameterFields
ParamField.Add(ParamFld)
CrystalReportViewer1.ParameterFieldInfo = ParamField
CrystalReportViewer1.ReportSource = New REPORT_DATA_ORDER_UNCONDITIONAL()
Return