Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to pass PictureBox to rdlc report, but I get this error

[cannot convert from 'System.Drawing.Image' to 'string'][1]


         private void ReportPrintDes_Load(object sender, EventArgs e)
        {
            pictureBox1.Image = picQr;
            pictureBox2.Image = picQr2;


            reportViewer1.LocalReport.EnableExternalImages = true;
            ReportParameter img = new ReportParameter("img", (pictureBox1));
             this.reportViewer1.RefreshReport();
          



        }


Is there any way to change PictureBox(image) to string, or another way to pass PictureBox to rdlc report?


  [1]: https://i.stack.imgur.com/XMKOe.png


What I have tried:

I tried to get the image path and send it to the rdlc report, but I did not know how to get image path
Posted
Updated 25-May-18 20:45pm
Comments
[no name] 25-May-18 18:35pm    
Maybe it helps:Google[^]
Dave Kreskowiak 26-May-18 11:20am    
You can't pass a PictureBox control to RDLC. It has no idea what a Windows Forms Control is or what to do with it.

1 solution

See example here: How to add an external image in RDLC Report (C#)[^]
You can save the image first like this:
pictureBox1.Image.Save(@"C:\Temp\Mypic.jpg",ImageFormat.Jpeg);
 
Share this answer
 
v2
Comments
Ahmed Taha 26-May-18 8:54am    
I do not know how I can get the image path??
Dave Kreskowiak 26-May-18 11:20am    
"Get"? You make it up yourself!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900