Button to add employee image?

jackmac

Member
Joined
Apr 20, 2005
Messages
9
Programming Experience
Beginner
Hi all,

I have a form which holds employee records. I can add info etc, edit and delete records. What I want to do now is add an picture of the employee. I'd like a button I can click to browse to the picture (all pics will be in the same folder obviously) then save that picture against the current record.

I've searched and found lots about adding a general image (which I already did with the company logo) but nothing to help me with a picture for a record.

I'm using Vis Studio 2008 if that's any help?

TIA

Jack
 
Found the answer!!!

Hi all,

I found the way to put the image into the app. The code for it is shown below:

Private Sub ImageInsert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddPicButton.Click

Dim openFileDialog1 As New OpenFileDialog()
openFileDialog1.Title = "Select an image File"
' Show the Dialog.
' If the user clicked OK in the dialog, open it.
If openFileDialog1.ShowDialog() = DialogResult.OK Then

ImagePictureBox.Image = Image.FromFile(openFileDialog1.FileName)
End If
End Sub
 
You need to convert the Image to a Byte array and then save that to the database as you would any other data. When you retrieve the data it comes back as a Byte array and you convert that to an Image.

[ame=http://www.vbforums.com/showthread.php?t=469562]Saving Images in Databases[/ame]
 
Back
Top