|
-
Dec 13th, 2007, 01:12 PM
#1
Thread Starter
Frenzied Member
[1.0/1.1] OpenFileDialog breaks Crystal Reports
I want to pass the filename and location of an image to a Crystal Report.
This works fine if I hardcode the image path such as
Code:
string ImagePathTest = @"C:\temp\image.jpg";
myRpt.SetParameterValue("ImagePath", this.lblImagePath.Text);
//OR
myRpt.SetParameterValue("ImagePath", @"C:\temp\image.jpg");
But I can't use an openFileDialog to select the image as I always get "Report Load Failed".
This happens even if I don't use the file selected from the dialog. i.e. just clicking on the openfileDialog but passing hardcoded strings causes the report to fail to load.
I even tried adding a new form before this one that contained an openFileDialog and passed the file path but the result was the same.
It's as if just opening the OpenFileDialog is causing the report to not load!
Thanks in advance.
-
Dec 22nd, 2007, 01:40 AM
#2
Re: [1.0/1.1] OpenFileDialog breaks Crystal Reports
I'll wager that your report is using the current directory, i.e. the value in Environment.CurrentDirectory. When you change the path in a FileDialog it changes the current directory. By default that change remains after the FileDialog closes. If you set the RestoreDirectory property to True then the original path of the current directory will be restored when the FileDialog closes. I'm willing to bet that that will fix your problem.
-
Dec 22nd, 2007, 10:27 AM
#3
Thread Starter
Frenzied Member
Re: [1.0/1.1] OpenFileDialog breaks Crystal Reports
Ah that all sounds very reasonable, so I'm not prepared to take your wager. Instead I'll just try it out.
Cheers.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|