Skip to Content

Image Not Showing Using Parameters

hi.. i have a problem with crystal report. (im using visual studio 2019 / visual basic .net) i have a picture in the report with a parameter attach to it. in the windows form, when i try to preview the report, the image will not show up. i passed a value to the parameter using the code below:

myReport.SetParameterValue("paramImagePath", imagePath) 

'myReport is the instance of the report

paramImagePath is the name of the parameter in the report

'imagePath is the variable i use.

when im using a variable, the image will not show up. i checked the value of the variable many time, it is the same with the manually inputted path of the image.

but when i input the path of the image manually, like the code below :

 myReport.SetParameterValue("paramImagePath", "E:\From Drive D\VB Net Activities\BrgyPoblacion\BrgyPoblacion\Images\1.png")

the image will show up. what seems to be the problem.

please help regards.

Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • Best Answer
    Posted on Jul 26, 2020 at 07:04 AM

    SOLVE it.

    i copied a temporary image to the debug folder, same id/or name with the image.

    thanks for the help.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 17, 2020 at 02:45 PM

    Have you verified that imagePath has a valid value that points to the file that you want to show? Or does it just have the path to a set of image files?

    -Dell

    Add a comment
    10|10000 characters needed characters exceeded

    • hi.. thanks for your reply.. as stated above, i have checked and verified the value of the imagePath variable.. it has the same value with the manually inputted path.. for example.. the manually inputted path is

      "E:\From Drive D\VB Net Activities\BrgyPoblacion\BrgyPoblacion\Images\1.png"

      the value of the imagePath variable is the same (as you can see in the picture above).

      imagepathvalue.jpg (23.9 kB)
  • Posted on Jul 23, 2020 at 08:13 PM

    That's not the CR image Dell was talking about.

    In my Parameter test app there is this routine:

    case "Graphic Location Formula":
        #region GRaphicsLocal
        btnReportObjects.Text = "";
    
        CrystalDecisions.ReportAppServer.ReportDefModel.ConditionFormula myGraphicLocationFormula;
        rptObjs = rptClientDoc.ReportDefController.ReportObjectController.GetReportObjectsByKind(CrReportObjectKindEnum.crReportObjectKindPicture);
    
        // get the count of picture objects
        btnCount.Text = rptObjs.Count.ToString();
        foreach (CrystalDecisions.ReportAppServer.ReportDefModel.PictureObject MyrptObj in rptObjs)
        {
            if (((dynamic)MyrptObj).GraphicLocationFormula.Text != null)
            {
                textBox1 = "Picture Name: " + MyrptObj.Name.ToString() + "\n";
                textBox1 += "Graphic Location Formula:     " + MyrptObj.GraphicLocationFormula.Text.ToString() + "\n";
                btnReportObjects.Text += textBox1;
                btnReportObjects.AppendText(" 'End' \n");
            }
            else
            {
                textBox1 = "Picture Name: " + MyrptObj.Name.ToString() + "\n";
                textBox1 += "Graphic Location Formula: None\n";
                btnReportObjects.Text += textBox1;
                btnReportObjects.AppendText(" 'End' \n");
            }
        }
        #endregion GRaphicsLocal
        break;

    You can modify it to update the formula field that has the path in it.

    https://blogs.sap.com/2016/02/17/how-to-parameters-in-crystal-reports-for-visual-studio-net/

    You will need to set this up in the Report also.

    Don

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 26, 2020 at 05:16 AM
    hi thanks for the reply.. i dont really get it..

    my problem is that the image will show up if i manually inputted the image location.

    sample.

    myReport.SetParameterValue("paramImagePath", "E:\From Drive D\VB Net Activities\BrgyPoblacion\BrgyPoblacion\Images\1.png")

    but when i use a variable to set the image, like the code below

    myReport.SetParameterValue("paramImagePath", imagePath) 

    the image will not show up.. even though the variable has the same value with the MANULLY inputted value.

    I CAN SEE THE IMAGE IF THE VALUE TO THE PATH IS MANULLY INPUTTED IN THE PARAMETER.

    what seems to be the problem here?

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 27, 2020 at 08:42 PM

    Issue was likely permissions....

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.