Application.DoEvents()
Dim strline, strArr() As String
Dim fs As IO.StreamReader
If IO.File.Exists(Application.StartupPath + "/" + ServerFile) Then
fs = (IO.File.OpenText(Application.StartupPath + "/" + ServerFile))
strline = fs.ReadLine
strArr = strline.Split("|")
fs.Close()
End If
Dim repdoc As New CrystalDecisions.CrystalReports.Engine.ReportDocument
Try
repdoc.Load("..\reports\rpt_Bill.rpt")
Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo
For Each tbCurrent In repdoc.Database.Tables
tliCurrent = tbCurrent.LogOnInfo
tliCurrent.ConnectionInfo.ServerName = strArr(0)
tliCurrent.ConnectionInfo.UserID = strArr(1)
tliCurrent.ConnectionInfo.Password = strArr(2)
tliCurrent.ConnectionInfo.DatabaseName = strArr(3)
tliCurrent.TableName = tliCurrent.TableName
tbCurrent.ApplyLogOnInfo(tliCurrent)
Next tbCurrent ' <end>
repdoc.RecordSelectionFormula = "{Vw_rpt_Bill.Bill_No}='" & txtBill.Text & "'"
If MsgBox("Do you want the print the bill?", MsgBoxStyle.YesNo, "TEST") = MsgBoxResult.Yes Then
repdoc.PrintToPrinter(1, True, 0, 0)
Else
Exit Sub
End If
Catch
MsgBox(Err.Description)
Finally
ObjFrm2 = Nothing
End Try
No comments:
Post a Comment