Skip to Content
0
Former Member
Jan 15, 2009 at 08:03 PM

Disable selective fields in Crystal Reports - Image Field

54 Views

Development Environment: VS 2005 Pro

Language: Visual Basic 2005

I have the following [template |http://www.coe.uncc.edu/~jjzachar/CRHelp/CRPhotoDisableHelp.JPG]generated for my reports and I want to figure out how to disable the "photo or image" field in the page footer, if image data is not provided.

The main pieces of code I am using to insert the image into crystal reports from my form are as follows:

' Add data into the dataset
ds.DataTable1.AddDataTable1Row(id, GetImageData(ofdImage.FileName), userName)

' GetImageData function
    Private Function GetImageData(ByVal fileName As String) As Byte()

        Dim fs As System.IO.FileStream = New System.IO.FileStream(fileName, IO.FileMode.Open, IO.FileAccess.Read)
        Dim br As System.IO.BinaryReader = New System.IO.BinaryReader(fs)
        Return (br.ReadBytes(Convert.ToInt32(br.BaseStream.Length)))

    End Function