Ok - just put lots of images into a database table.
Using this method right now to get them into an image control.
This works fine - takes the place of the old code:Code:Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset rs.Open "Exec GetStuPhoto_P '" & s3 & "'", gCn, adOpenForwardOnly, adLockReadOnly, adCmdText If rs.EOF Then rs.Close Set rs = Nothing End If Set .imgImage.DataSource = rs .imgImage.DataField = rs.Fields(0).Name rs.Close Set rs = Nothing
But it requires binding - which requires MSBIND.DLL be on the users machine and registered. I've got over a 1000 PC's that would need this install - not a very happy moment for the IT department!Code:.imgImage.Picture = LoadPicture(s1)
So .Net does it this way:
Nice and sweet - picturedata comes into a byte array - memorystream with bitmap turns it back into an image - and it's loaded into the image control.Code:Drc.CommandText = "Select ActualImage From Student Where ActualImage is not null and StuId=" & strId Try Dim PictureData As Byte() = DirectCast(Drc.ExecuteScalar, Byte()) Using stream As New IO.MemoryStream(PictureData) Dim im As Image = New Bitmap(stream) pbxStudent.Image = im pbxStudent.Visible = True pbxStudent.BringToFront() End Using Catch ex As Exception pbxStudent.Visible = False End Try
How could I do this same thing in VB6???
I do not want to take the binary data and create a temp jpg file for loadpicture - that is not an option.
Thanks!




Reply With Quote