Question Binary Images not showing

seq_jason

New member
Joined
Sep 30, 2013
Messages
2
Programming Experience
3-5
Hi There,

Can anyone help me with my problem, I used VB.net 2010
I have Picture Boxes that suppose to show the Employees'
photo, I fetch the photo from the database with Binary Format.

In windows XP and windows 7, the photos are showing fine
but in Windows 8, the photos are not displaying.

Badly need help.
Thanks and best regards to everyone.
 

Attachments

  • Untitled.png
    Untitled.png
    20.1 KB · Views: 41
Last edited:
no exceptions thrown,
but here's the set of codes:
    Private Sub ShowStaffListPage(ByRef nStaffCurrentPage As Short)
        Dim nCountLine As Short
        Dim sSql As String
        Dim nX As Short
        On Error GoTo HandleError


        rsTmpStaff = New ADODB.Recordset
        rsTmpStaff.let_ActiveConnection(dbData)
        rsTmpStaff.CursorType = ADODB.CursorTypeEnum.adOpenDynamic
        rsTmpStaff.LockType = ADODB.LockTypeEnum.adLockOptimistic
        rsTmpStaff.let_Source(sStaffSQL)
        rsTmpStaff.Open()


        nCountLine = 0


        If nStaffCurrentPage <= 0 Then
            Exit Sub
        End If


        For nX = 0 To nStaffButtonCount - 1
            cmdUser(nX).Visible = False
            lblName(nX).Visible = False
        Next


        If rsTmpStaff.BOF And rsTmpStaff.EOF Then
        Else
            rsTmpStaff.MoveFirst()
            rsTmpStaff.Move(((nStaffCurrentPage * nStaffButtonCount) - nStaffButtonCount))
        End If
        UpdateStatus()
        Do While Not rsTmpStaff.EOF
            lblName(nCountLine).Visible = False
            cmdUser(nCountLine).Visible = True
            'cmdUser(nCountLine).Image = System.Drawing.Image.FromFile("")
            'cmdUser(nCountLine).Caption = ""


            'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
            If IsDBNull(rsTmpStaff.Fields("sPIC").Value) = False Then
                If rsTmpStaff.Fields("sPIC").Value <> "" Then


                    'Call LoadPictureFromDB(CmdStaff(0), rsTmpStaff, "Emp_Pic_B")
                    'Call LoadPictureFromDB(cPic, rsTmpStaff, "Emp_Pic_B")
                    Call LoadPictureFromDB(cmdUser(nCountLine), rsTmpStaff, "Emp_Pic_B")
                    'If FSys.FileExists(rsTmpStaff.Fields("sPIC")) Then
                    'cPic.picture = LoadPicture(rsTmpStaff.Fields("sPIC"))
                    'Call ScalePictureBoxImage(cPic)
                    lblName(nCountLine).Visible = True
                    'cmdUser(nCountLine).picture = cPic.Image
                    'cmdUser(nCountLine).Caption = ""
                    'Else
                    '    lblName(nCountLine).Visible = False
                    '    cmdUser(nCountLine).picture = LoadPicture("")
                    '    cmdUser(nCountLine).Caption = rsTmpStaff.Fields("sUser") & ""
                    'End If
                Else
                    'lblName(nCountLine).Visible = False
                    cmdUser(nCountLine).Image = System.Drawing.Image.FromFile("")
                    'cmdUser(nCountLine).Caption = rsTmpStaff.Fields("sUser") & ""
                End If






            End If
            'lblName(nCountLine).Visible = True
            lblName(nCountLine).Text = rsTmpStaff.Fields("sUser").Value & ""


            cmdUser(nCountLine).Tag = rsTmpStaff.Fields("sCODE").Value & ""


            nCountLine = nCountLine + 1
            nButtonStaff = nCountLine
            If nCountLine >= nStaffButtonCount Then
                Exit Sub
            End If
            rsTmpStaff.MoveNext()
        Loop


        Exit Sub
HandleError:
        Call HandleErrLog(Err.Number & "->" & Err.Description & "Current Page:" & nStaffCurrentPage, "frmAttendance->ShowStaffListPage", "")
    End Sub
 
Last edited by a moderator:
Back
Top