none
Programmatically Change Image? RRS feed

  • Question

  • I have a ReportViewer control in a Windows Forms application. I'd like to be able to change some images within a report at runtime, but I can't figure out how to programmatically access controls within a LocalReport object. Is there a way to do this?

     

    This is the type of thing I'm after:

     

    MyReportViewer.LocalReport.Controls["image_1"].Source = External;

    MyReportViewer.LocalReport.Controls["image_1"].Value = file://C:\images\reportimage.jpg;

     

    Chris

    Tuesday, September 11, 2007 12:32 AM

All replies

  • The ReportViewer can rather trivially display images as fields. Why not put the image into a dataset, or you could probably use code to stuff it into the field, rather than trying to programmatically access the field externally?

     

    I've not done the latter, but the former is pretty standard faire... I've not done precisely that, but again displaying images is pretty standard RV stuff...

     

    Tuesday, September 11, 2007 8:45 PM
  • you can definitely do this.  Just pass the file information to your report as a parameter, and make the value expression for that image reference the parameter, instead of being a literal.

     

    >L<

     

    Thursday, September 13, 2007 2:37 AM