Set the image in BeforePrint event

Stimulsoft Reports.NET discussion
Post Reply
isoft
Posts: 55
Joined: Fri Sep 08, 2006 9:33 am
Location: Croatia

Set the image in BeforePrint event

Post by isoft »

Hello.

I am trying to set the Image property of the Image controls in the beforeprint event. My image is placed in the same folder where the report is. But, I cannot get the path of the report. I have tried using this code, but I get an error:

Image1.Image = Image.FromFile("logo.jpg")

This also doesn't work:

Image1.Image = Image.FromFile("\\logo.jpg")

Is there any way to get the path of the report?

Thanks in advance.
Ivan
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Set the image in BeforePrint event

Post by Alex K. »

Hello,

Please see the sample report in attachment.

Thank you.
Attachments
781.Sample.zip
(8.51 KiB) Downloaded 424 times
isoft
Posts: 55
Joined: Fri Sep 08, 2006 9:33 am
Location: Croatia

Set the image in BeforePrint event

Post by isoft »

Hi, Aleksey.

Thank you very much for the reply. Unfortunately, it's still not working. The image is not shown in my Image1 control. I don't know what syntax to use to set the image file path the same as the report file path. I have tried "\\myimage.png" and "myimage.png", but it's not working If you have any suggestions, I would really appreciate it.

Thank you,
Ivan
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Set the image in BeforePrint event

Post by Alex K. »

Hello,

Please send us your .MRT file with database for analysis.

Thank you.
isoft
Posts: 55
Joined: Fri Sep 08, 2006 9:33 am
Location: Croatia

Set the image in BeforePrint event

Post by isoft »

Hi.

It's a report that connects to a big sql server database. The problem is that even your sample application is not showing an image1, image2, image3 to me. Is it possible this is due to version of my stimulsoft reports? I have a 2011.1.904.0 version running on Win 7.

Thanks,
Ivan
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Set the image in BeforePrint event

Post by Ivan »

Hello,

The ReportFile property of the report contain the filename of the report (if report was loaded from the file).
Please check the "SampleReport2.mrt" in attachment.

Thank you.
Attachments
790.Sample2.zip
(7.57 KiB) Downloaded 487 times
isoft
Posts: 55
Joined: Fri Sep 08, 2006 9:33 am
Location: Croatia

Set the image in BeforePrint event

Post by isoft »

That is what I was looking for!! Thank you very much!

Best regards,
Ivan
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Set the image in BeforePrint event

Post by Andrew »

Great!

Have a nice day!
Post Reply