Framework EDI Reference. Methods and Properties
ediDataElement. ImageValue

Gets or sets the value of the data element as an image file.

Syntax:

Remarks

When assigning an image file to the data element value, the object must be of type IPictureDisp and the binary content of the file overwrites any existing value.  When attempting to retrieve an image from a data element value, an image object IPictureDisp is returned only if the data element value is of the following image binary:

If the data element value is not an image file, the property returns an empty object or NULL.  However, please note that this does not mean that data is not present.  If the property returns an empty value, use the DataLength property of the data element to indicate if data is present and then use either Value or FileValue to retrieve the data.

Example 1: Getting the image


Dim oDataElement As Fredi.ediDataElement
Dim oDataSegment As Fredi.ediDataSegment
Dim oImage As IPictureDisp

....

' Get first data segment in document.
Set oDataSegment = oEdiDoc.FirstDataSegment

' Get the data element containing image value.
Set oDataElement = oDataSegment.GetDataElementByPos("\ISA\GS\ST\PWK\EFI\BIN<785>")

' Set the picture object from the value of the data element.
Set Form1.Picture1.Picture = oDataElement.ImageValue

Example 2: Setting the image

Dim oDataElement As Fredi.ediDataElement
Dim oDataSegment As Fredi.ediDataSegment

....

' Get first data segment in document.
Set oDataSegment = oEdiDoc.FirstDataSegment

' Get the data element to store the image.
Set oDataElement = oDataSegment.GetDataElementByPos("\ISA\GS\ST\PWK\EFI\BIN<785>")

' Set the value of the data element to the image
Set oDataElement.ImageValue = Form1.Picture2.Picture

' Save document with assigned image to new file.
oEdiDoc.Save App.Path & "\TestOutput.Txt"

MsgBox "Image saved to file " & App.Path & "\TestOutput.Txt"

Sample

P_ImageValue.zip