How to display image into report viewer rdlc

Jaymi 20 Reputation points
2024-08-23T23:59:59.3+00:00

I want to display the image from picturebox to the inside of the report viewer RDLC

User's image

Developer technologies C#
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2024-08-26T08:22:06.4366667+00:00

    Hi @Jaymi , Welcome to Microsoft Q&A,

    If you choose to load the picture from a database, you need to bind the picture data to the RDLC report in code.

    // Assume your DataTable contains an image column
    DataTable dt = new DataTable();
    dt.Columns.Add("ImageData", typeof(byte[]));
    
    // Load image data
    byte[] imageData = File.ReadAllBytes("path/to/your/image.jpg");
    DataRow row = dt.NewRow();
    row["ImageData"] = imageData;
    dt.Rows.Add(row);
    
    // Bind the DataTable to the report data source
    ReportDataSource rds = new ReportDataSource("YourDataSetName", dt);
    reportViewer.LocalReport.DataSources.Clear();
    reportViewer.LocalReport.DataSources.Add(rds);
    reportViewer.RefreshReport();
    

    Best Regards,

    Jiale


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.