CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2011
    Posts
    73

    [RESOLVED] How to add a Rdlc Report file to .Resx Resource file ?

    I have a small project in VS2010.In that project I have one resource file called MyResources.resx. Now Iam using this MyResources.resx file to store the images required in my project. Also I have one report called REPORT1.rdlc. My Intention is to add that report file to that MyResources.resx resource file. Is it possible to access the report from that resouce file ?

    From the below example, I stored Thatha.jpg image file in MyResources.resx. and accessed.
    Code:
    ResourceManager^ rm = gcnew ResourceManager("NewTest_EmbedRpt.MyResources", GetType()->Assembly);
    pictureBox1->Image = safe_cast<Image^>(rm->GetObject("Thatha"));
    Same way is it possible to store that Report1.rdlc in resources and can access?
    Any codes and ideas will be very helpful.


    Note: In c# BuidAction property is available to set the Report1.rdlc as EmbeddedResource.

    Thanks for the guidances.

  2. #2
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,675

    Re: How to add a Rdlc Report file to .Resx Resource file ?

    This post demonstrates using a file resource: http://forums.codeguru.com/showthrea...39#post1994339. It's a cursor file (.cur) there, but as that isn't any specific managed resource type either, after all it's about handling general file resources.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  3. #3
    Join Date
    Dec 2011
    Posts
    73

    Re: How to add a Rdlc Report file to .Resx Resource file ?

    Thanks Eri. You are my Visual C++ GURU. Thousands of thanks to you. Most of my Counter Variables are ERI ....only
    Since I would like to remember with my lifetime to those kind helps & guidances....

    As per your advise, the below code works like embedded report from resource, So that the enduser no need to keep the rdlc file in their program folder.

    Codes
    ======
    Code:
    ResourceManager^ rm = gcnew ResourceManager("NewTest_EmbedRpt.MyResources", GetType()->Assembly);
    MemoryStream ^MyRptStream = gcnew MemoryStream(static_cast<array<Byte> ^>(rm->GetObject("Report1")), false);
    reportViewer1->LocalReport->LoadReportDefinition(MyRptStream);
    Thanks again

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured