I'm using VB.NET 2003 windows application.
i'm trying to display Crystal Reports using CrystalReportViewer.
Code i'm using to display "ZTab.rpt" in CrystalReportViewer when Form_Load
i have checkbox that contain list of crystal report. if i select one crystal report and hit button "Run", it displays that crystal report.
Code i'm using to display another (differenet) crystal report in CrystalReportViewer when Button (btnRun) clicked.
so when Form_load, it displays "ZTab.rpt" and when i select one crystal report in combobox and hit button "Run", it displays corresponding crystal report. that works fine.
how can i change the datasource of a report during run time using codes (programming).
for example: if we are using datasource "work.mdb" for "ZTab.rpt" when form_load. when i hit a button, how come i change the datasource to "Employee.mdb" for "ZTab.rpt" during run time using codes. so when form_load it will display ZTab.rpt with datasource "work.mdb" and when i hit a button, it will display ZTab.rpt with datasource "Employee.mdb".
If you have any idea how to do this, please help me. if you can provide an example then it will be great help for me.
Thanks in advance.
i'm trying to display Crystal Reports using CrystalReportViewer.
Code i'm using to display "ZTab.rpt" in CrystalReportViewer when Form_Load
VB.NET:
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CrystalReportViewer1.ReportSource = "ZTab.rpt"
CrystalReportViewer1.Zoom(1)
End Sub
i have checkbox that contain list of crystal report. if i select one crystal report and hit button "Run", it displays that crystal report.
Code i'm using to display another (differenet) crystal report in CrystalReportViewer when Button (btnRun) clicked.
VB.NET:
Private Sub btnRun_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRunNow.Click
CrystalReportViewer1.ReportSource = combobox1.SelectedItem
CrystalReportViewer1.Zoom(1)
End Sub
so when Form_load, it displays "ZTab.rpt" and when i select one crystal report in combobox and hit button "Run", it displays corresponding crystal report. that works fine.
how can i change the datasource of a report during run time using codes (programming).
for example: if we are using datasource "work.mdb" for "ZTab.rpt" when form_load. when i hit a button, how come i change the datasource to "Employee.mdb" for "ZTab.rpt" during run time using codes. so when form_load it will display ZTab.rpt with datasource "work.mdb" and when i hit a button, it will display ZTab.rpt with datasource "Employee.mdb".
If you have any idea how to do this, please help me. if you can provide an example then it will be great help for me.
Thanks in advance.