Professional Documents
Culture Documents
I. Creating Project
1. Creating a new Visual Basic Windows Application project named UsingCrystalReport.
2. Rename Form1.vb to frmMain.vb.
3. Design frmMain.vb look like:
Trang 1
Lab 6_4 Creating Reports by Using Crystal Reports
Imports System.Data
Imports System.Data.SqlClient
Imports CrystalDecisions.CrystalReports.Engine
Trang 3
Lab 6_4 Creating Reports by Using Crystal Reports
BindToDataSet()
7. Open “Windows Form Designer generated code”, in Sub New type the following code:
KetNoi()
8. Double click “Danh mục đối tượng” then type the following code:
Trang 4
Lab 6_4 Creating Reports by Using Crystal Reports
9. Double click “Liệt kê chứng từ theo phiếu” then type the following code:
rptPhieu.SetParameterValue("@pidkey", cbPhieu.Text)
rptPhieu.SetParameterValue("sCompanyName", "Trung Tâm Tin Học - DHKHTN")
rptPhieu.SetParameterValue("sUnitName", "CSC - TATA")
crvThamso.DisplayGroupTree = False
crvThamso.ReportSource = rptPhieu
crvThamso.Zoom(4)
10. Double click “Liệt kê chứng từ” then type the following code:
rptLietke.SetParameterValue("vngaythang", CDate(Tungay.Text))
rptLietke.SetParameterValue("@Tungay", CDate(Tungay.Text))
rptLietke.SetParameterValue("@Denngay", CDate(Denngay.Text))
rptLietke.SetParameterValue("vtongcongty", "Trung Tâm Tin Học- DHKHTN")
rptLietke.SetParameterValue("vtencty", "CSC - TATA")
rptLietke.SetParameterValue("@dsdonvi", "*")
rptLietke.SetParameterValue("@loaibc", "CT")
rptLietke.SetParameterValue("@Loaict", "TH")
crvPhuc.DisplayGroupTree = True
crvPhuc.ReportSource = rptLietke
crvPhuc.Zoom(4)
Trang 6