Results 1 to 6 of 6

Thread: External image show only red x

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2016
    Location
    South Africa
    Posts
    141

    External image show only red x

    I have inserted an external image on my report. The report shows the image at design, but once I run my application only a red x is shown.
    Any help would be much appreciated. Could it be a permisssions problem? How do I fix this?
    Regards

  2. #2
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: External image show only red x

    Without any code it will be hard to tell.
    Generally, you probably have something being done in the paint event and what you are referencing isn't valid yet at the time the first paint event happens.
    You will usually need to add some test, eg. check to see if an object you are going to use in your paint event to draw with is not nothing before you draw.
    If it is nothing then skip the drawing this time, and hopefully you'll get another paint event later, (or you can cause one), to do the drawing when the object is available.

    Once the code in the paint event has failed, and the red X is displayed, I haven't found a way to fix that in already running code. You have to prevent the failure from happening.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2016
    Location
    South Africa
    Posts
    141

    Re: External image show only red x

    Thank you passel for answering : Here is my code :


    Imports Microsoft.Reporting.WinForms


    Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Me.ReportViewer1.LocalReport.ReportPath = "C:\Users\Administrator\Desktop\Trash\WindowsApplication50\WindowsApplication50\Report1.rdlc"


    Dim parametervb As ReportParameter
    parametervb = New ReportParameter("ReportParameter1", "File:" + "C:\Users\Administrator\Desktop\SKEDULERING\Grafieka\Plaaskaarte\8471.bmp", True)

    ReportViewer1.LocalReport.EnableExternalImages = True
    ReportViewer1.LocalReport.SetParameters(New ReportParameter() {parametervb})

    Me.ReportViewer1.RefreshReport()



    End Sub
    End Class

  4. #4
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: External image show only red x

    I don't know anything about Microsoft.Reporting.
    Perhaps the executable has to be tagged to run with administrator privileges to access where the picture is located.
    Also Windows does odd things with file paths sometimes so perhaps the path isn't valid when running outside the development environment.
    For a test, you should be able to create a directory right off the root, for example "c" off the C: directory "C:\c" and place the picture in there and change the path in the code to see if that makes any difference. That isn't the solution but may show that the path to the bitmap is the issue.
    If it still doesn't work, then I don't really have an idea. I haven't worked with ReportViewer before.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Nov 2016
    Location
    South Africa
    Posts
    141

    Re: External image show only red x

    Thank you passel. It seems no-one has a answer to my issue.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Nov 2016
    Location
    South Africa
    Posts
    141

    Re: External image show only red x

    Can anyone refer me to some-one that might help me with this issue?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width