Tuesday, February 22, 2011

Using Crystal Report (vb.net desktop application)

This case explained how to use crystal report in VB.Net. This is the syntax that maybe helpfull in show crystalreport


How to create crystal report:
- Right click your project in the solution explore
- add new item>crystal report

How to set connection in crystalreport:
- create new connection>ole db(ado)
- microsoft office 12.0 access database engine ole db provider for ms.access
- fill the data source with your correct path your database source
- click finish



Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Classdatabase.ds.Clear()
Classdatabase.bukadatabase()
Classdatabase.perintahsql.CommandText = "select * from keluar"
Classdatabase.da.SelectCommand = Classdatabase.perintahsql
Classdatabase.da.Fill(Classdatabase.ds, "keluar")

Dim cetak As New CrystalReport1
Dim tampil As New Formlaporan

cetak.SetDataSource(Classdatabase.ds)
tampil.CrystalReportViewer1.ReportSource = cetak
tampil.WindowState = FormWindowState.Maximized
tampil.Refresh()
tampil.Show()
Classdatabase.tutupdatabase()
End Sub

No comments:

Post a Comment

web programming