cancel
Showing results for 
Search instead for 
Did you mean: 

Image Not Showing Using Parameters

jencendencia75
Explorer
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

jencendencia75
Explorer
0 Kudos

SOLVE it.

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

thanks for the help.

Answers (4)

Answers (4)

0 Kudos

Issue was likely permissions....

jencendencia75
Explorer
0 Kudos
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?

0 Kudos

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

DellSC
Active Contributor
0 Kudos

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

jencendencia75
Explorer
0 Kudos

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).