Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 27th, 2009, 11:16 PM
Authorized User
Join Date: Sep 2007
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Default Change Datasource in CrystalReport - VB.NET

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

    Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

            CrystalReportViewer1.ReportSource = "ZTab.rpt"

    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.

    Private Sub btnRun_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRunNow.Click

        CrystalReportViewer1.ReportSource = combobox1.SelectedItem

    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.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Change Datasource in CrystalReport - VB.NET remya1000 Crystal Reports 1 February 4th, 2009 01:05 PM
Change datasource of crystal report at runtime check123 Pro VB 6 1 March 21st, 2008 05:45 AM
change Datasource of a crystal report at run time tiyyob Pro VB 6 1 February 17th, 2007 06:05 AM
Datasource Change tjmherman Crystal Reports 2 August 2nd, 2006 10:24 AM
CrystalReport.net VisualStudio 2005 ASP.net (VB) pgkdave Crystal Reports 0 June 16th, 2006 09:39 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.