Save a Blank Picture box to database
-
i have a windowform with employee image, Firstname and other data. I can save the image of the employee(when loaded into the image control) but when i dont load the picture in the image control it flags error t.aransiola
And the error would be ...??? What about the code that's throwing it?? You only use a PictureBox to show an image, not to store it. And I'm not real thrilled with the idea of even using a PictureBox in most cases. You do NOT do something like this:
PictureBox1.Image.Save...
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
And the error would be ...??? What about the code that's throwing it?? You only use a PictureBox to show an image, not to store it. And I'm not real thrilled with the idea of even using a PictureBox in most cases. You do NOT do something like this:
PictureBox1.Image.Save...
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
instead of saving a blank picture box why not save a default image such as the company logo or such like. you can trap the error then load the default picture on this error.
-
Iwant the Image Field remain Null for those that doesnt have picture. saving a default image in the database will impact the db thanks t.aransiola
The picturebox should be there to show a picture, not to store one. If the database doesn't have a picture, you can either choose set the PictureBox's Image property to Nothing, or you can show a blank image or silohette image. It appears you already have a picture in an Image object. After all, you have to set the PictureBox's image property to it so it shows up. So, you can save the image data to your database from the original image object, without using any of the properties of the PictureBox.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007