How to get path of .rpt file @ runtime

P

Pioneer

HI,
I have set of crystal reports in my code. as of now they have absolute
path which need to be changed so that i can specify location @
runtime

any method to get paths at runtime?

I am using below code but it doesnt seem to yield result

CrystalDecisions.CrystalReports.Engine.ReportDocument obj_rpt = new
CrystalDecisions.CrystalReports.Engine.ReportDocument();

obj_rpt.FileName=Assembly.GetExecutingAssembly ();
thanks
 
I

Ignacio Machin ( .NET/ C# MVP )

HI,
I have set of crystal reports in my code. as of now they have absolute
path which need to be changed so that  i can specify location @
runtime

any method to get paths at runtime?

I am using below code but it doesnt seem to yield result

CrystalDecisions.CrystalReports.Engine.ReportDocument obj_rpt = new
CrystalDecisions.CrystalReports.Engine.ReportDocument();

obj_rpt.FileName=Assembly.GetExecutingAssembly ();
thanks

Hi,

What are you trying to do?
usually CR reports are embedded in the assembly. no need to load them.
If you are using external .rpt files that sits next to the assembly
you could do something like:
obj_rpt.FileName=Assembly.GetExecutingAssembly ().Location + "\
\myreport.rpt";
 
P

Pioneer

Hi,

What are you trying to do?
usually CR reports are embedded in the assembly. no need to load them.
If you are using external .rpt files that sits next to the assembly
you could do something like:
obj_rpt.FileName=Assembly.GetExecutingAssembly ().Location + "\
\myreport.rpt";

Hi,
as of now the report path is part of code itself
rpt.FileName = @"C:\Documents and Settings\xyz\Desktop\version1\tab
\Reports\Form8.rpt"
Now just like we do with DB connetion string, putting it in config
file so that it can be changed at rnutime, I got to apply the same
principle to path specified above.
Thats what I need to achieve.
ny pointers?
thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top