locked
Windows Application with rdlc (Report)-Changing report(path) on run-time RRS feed

  • Question

  • Hi,

    I am new to Visual Studio.

    I created a windows application having a form with reportviewer,project also contains few rdlc files(I have added using Add>Existing Items). 

    How can i change the ReportPath on run-time, I know i can write ReportViewer1.LocalReport.ReportPath BUT =WHAT (path do i use).

    Secondly When I will publish my application to LocalHost, how can the user access the report.

    Please HELP

    Thanks in Advance

    Tuesday, January 4, 2011 3:43 PM

Answers

  • Can you put them in just as a file, and read them from the deployment folder?

    If you want to try this, set the build action to "Content" and "copy to output directory" to "copy always". And then when looking for them, they will be in the same folder as the exe file. For WinForms, System.Windows.Forms.Application.StartupPath. For WPF, check assembly codebase property. (Post back for help w/that if you need it).

    Will that work?

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Marked as answer by M Jahanzaib Tuesday, January 11, 2011 2:44 PM
    Friday, January 7, 2011 5:13 AM

All replies

  • What method of deployment are you using? Are you creating a setup & deployment package, or using ClickOnce (the publish tab in VS)?

    If using ClickOnce and deploying to localhost, the user can't access the deployment unless he runs it on your machine. What is your installation URL?

    Are the rdlc files in the top directory of your project? You need to set the build action to "Content" and "copy to output directory" to "copy always" so they will be included in the deployment.

    Is this a Windows Forms app or a WPF app or what? If Windows Forms, you can get the folder using System.Windows.Forms.Application.StartupPath.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Wednesday, January 5, 2011 7:16 PM
  • Thanks for reply Robin.

    I am using CLickOnce (using publish tab) to deploy.

    rdlc files are in the top directory and build action is Embedded Resource.

    It is Windows Form application.

     

    I tried one thing after posting this question, I set the report build action property to Embeded Resource from None. And changed code to ReportViewer1.LocalReport.ReportViewer1.LocalReport.ReportEmbeddedResource="<MyProject>.<ReportName>.rdlc"

    That works fine while debugging, but not after publishing.

    Says: An error occurred during local report processing. the report definition for 'C:\Local Settings\Apps\<........>\<MyProjectName>.<ReportName>.rdlc' has not been specified.

    I will appreciate any workable solution.

    Thursday, January 6, 2011 8:52 AM
  • Can you put them in just as a file, and read them from the deployment folder?

    If you want to try this, set the build action to "Content" and "copy to output directory" to "copy always". And then when looking for them, they will be in the same folder as the exe file. For WinForms, System.Windows.Forms.Application.StartupPath. For WPF, check assembly codebase property. (Post back for help w/that if you need it).

    Will that work?

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Marked as answer by M Jahanzaib Tuesday, January 11, 2011 2:44 PM
    Friday, January 7, 2011 5:13 AM
  • Thank you very much Robin, your last suggestion works..
    Tuesday, January 11, 2011 2:42 PM