Page 1 of 1

Set the image in BeforePrint event

Posted: Sun Jan 09, 2011 4:44 pm
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

Set the image in BeforePrint event

Posted: Mon Jan 10, 2011 3:50 am
by Alex K.
Hello,

Please see the sample report in attachment.

Thank you.

Set the image in BeforePrint event

Posted: Tue Jan 11, 2011 8:01 am
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

Set the image in BeforePrint event

Posted: Wed Jan 12, 2011 12:39 am
by Alex K.
Hello,

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

Thank you.

Set the image in BeforePrint event

Posted: Wed Jan 12, 2011 11:34 am
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

Set the image in BeforePrint event

Posted: Wed Jan 12, 2011 8:03 pm
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.

Set the image in BeforePrint event

Posted: Thu Jan 13, 2011 12:15 pm
by isoft
That is what I was looking for!! Thank you very much!

Best regards,
Ivan

Set the image in BeforePrint event

Posted: Thu Jan 13, 2011 2:22 pm
by Andrew
Great!

Have a nice day!