0

i have crystal report contain image, i want to pass the path of image vi parameter, here is c# code:

private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                string ImagePath = "D:/xx.png";
                QRCodeGenerator qrGenerator = new QRCodeGenerator();
                QRCodeData qrCodeData = qrGenerator.CreateQrCode(textBox1.Text, QRCodeGenerator.ECCLevel.Q);
                QRCode qrCode = new QRCode(qrCodeData);
                Bitmap qrCodeImage = qrCode.GetGraphic(20);
                qrCodeImage.Save(ImagePath, System.Drawing.Imaging.ImageFormat.Png);
                if (!File.Exists(ImagePath))
                {
                    MessageBox.Show("Not Found");
                    return;
                }
                Report1 r = new Report1();
                DataSet1 d = new DataSet1();
                r.SetDataSource(d);
                
              // byte[] data= ImageToByteArray(qrCodeImage);
                r.SetParameterValue("PathOfQRCodeImage", ImagePath);
                
                Form2 f = new Form2();
            f.crystalReportViewer1.ReportSource = r;
                f.ShowDialog();
       
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\n" + ex.StackTrace.ToString());
            }
        }

i click on Image in crystal report > format object > picture > graphic location and i put this formula as seen here : enter image description here the problem is that the image not changed to image i send vi parameter, here is screenshot: enter image description here i hope you help to solve this problem, please notes i have to send image path vi parameter. Thanks for help

Fath Bakri
  • 161
  • 1
  • 12

1 Answers1

0

You want to google for "crystal reports dynamic images". Answers include exposing the byte[] property for the report, using a conditional formula, and using an image path in your database.

Kevin
  • 398
  • 2
  • 7