none
Images not showing up

    Question

  • Hi,

    I'm using WCF to supply data for my screen.  Here is the structure:

        Public Class PalListStudent
            <Key> _
            Public Property StudentId() As String
                Get
                    Return _StudentId
                End Get
                Set(value As String)
                    _StudentId = value
                End Set
            End Property
            Private _StudentId As Integer
            Public Property ParentId As Integer
            '<Association("PalParentListStudents", "ParentId", "Id", IsForeignKey:=True)> _
            'Public Property Parent As PalParent
    
            Public Property StudentName() As String
                Get
                    Return _StudentName
                End Get
                Set(value As String)
                    _StudentName = value
                End Set
            End Property
            Private _StudentName As String
    
            Public Property GradeLevel() As String
                Get
                    Return _GradeLevel
                End Get
                Set(value As String)
                    _GradeLevel = value
                End Set
            End Property
            Private _GradeLevel As String
    
            Public Property SchoolName() As String
                Get
                    Return _SchoolName
                End Get
                Set(value As String)
                    _SchoolName = value
                End Set
            End Property
            Private _SchoolName As String
    
            Public Property FileImage() As Byte()
        End Class
    

    FileImage is a byte array and I use this routine to convert it to a byte array:

            Public Shared Function GetPicture(ByVal studentId As String) As Byte()
                Try
                    ' Load Image thumbnail
                    Dim strThumbnailFile As String = [String].Format("{0}s{1}.jpg", Pictures.PictureManager.RemotePath, studentId)
                    Dim sourceFile As New IO.FileStream(strThumbnailFile, IO.FileMode.Open)
                    Dim FileSize As Long
                    FileSize = sourceFile.Length
                    Dim getContent As Byte() = New Byte(CInt(FileSize) - 1) {}
                    sourceFile.Read(getContent, 0, CInt(sourceFile.Length))
                    sourceFile.Close()
                    Return getContent
                    ' Do nothing if image not found
                Catch
                    Return Nothing
                End Try
            End Function
    

    Here is the result on the screen:

    I do not understand why it thinks the images are not valid. 

    Any help would be appreciated.

    Tuesday, September 02, 2014 10:35 PM

All replies