This is the first time ever I've used a Forum so please forgive me if I don't follow the correct protocol or format.
I am trying to 1) write code in VB2010 that will get a JPG image from a Access Database field and write the image to a PictureBox 2) write code which will write a JPG file to an Access Database field. I have already sucessfully coded this in VB6, without
fully understanding what I was doing.
Browsing the various forum's I have come across a few discussions on this subject, but due to my complete amerture status I don't seem to be able to follow the logic.
Below is the VB6 code, can somebody help me convert this into VB2010 code.
Writing JPG file to DataBase:
Dim bytBlob() As Byte
Dim intNum As Integer
intNum = FreeFile
TextBoxPhoto.Text = "C:\Photos\Dog.jpg"
Open TextBoxPhoto.Text For Binary As #intNum
Get #intNum, , bytBlob
Photo from DataBase to PictureBox
'Load images - Blob method
strTempPic = "C\Temp\TempPic.jpg"
If Len(Dir(strTempPic)) > 0 Then Kill strTempPic
intFile = FreeFile
Open strTempPic For Binary As #intFile
lngImageSize = Recordset.Fields("fldPhoto").ActualSize
bytChunk() = Recordset.Fields("fldPhoto").GetChunk(lngImageSize)
Put #intFile, , bytChunk()
Image1.Picture = LoadPicture(strTempPic)
Naturally, if there is a more elegant and simpler way of doing this, I'm All ears