Saving and loading image files
Posted on 2004-11-01
I have a listbox(lstContacts) that displays my contacts. When I choose a contact from the list and then click "View" button , data related to him/her appears on left side of screen. On the left side of the screen, there's also an imagebox that displays his/her picture in an imagebox called picPhoto. Under that imagebox, button"Edit Picture" does the following.
.Filter = "Jpeg Files (*.jpg)|*.jpg|Gif Files (*.gif)|*.gif)|Bitmap Files (*.bmp)|*.bmp)"
.Title = "Choose an image to use"
If .ShowDialog <> DialogResult.OK Then Return
If .FileName <> "" Then
picPhoto.Image = Image.FromFile(.FileName)
As you'll see, i want user to be able to choose bmp's, jpeg's and gif's. But this does not save the image. How will i make it so that, when a contact's picture is selected after clicking "edit picture", program will pop up a message box asking "are you sure you want to use this picture as contact's display picture?" and when user clicks yes, it will automatically save the picture.
Later, when a contact is selected and "View" button is clicked, his/her picture in imagebox will appear automatically.
I'd really appreciate if you could give exact code for my need.