Picture Boxes / Pictures Propertys

I have a control where by I can set a picture as a property.

How can I detect if there is a picture assigned to the property.

I also need to know the same thing for a picture box.

This is urgent so points are high.
Terry RogersIT Technical ArchitectAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TomlinsonHigh School Computer Science, Computer Applications, Digital Design, and Mathematics TeacherCommented:
Try this...Create a New Project and add a CommandButton and two PictureBoxes.  Leave the first PB blank but set the Picture() property on the second PB:

Private Sub Command1_Click()
    Debug.Print "Picture1:" & HasPicture(Picture1)
    Debug.Print "Picture2:" & HasPicture(Picture2)
End Sub

Private Function HasPicture(ByVal pb As PictureBox) As Boolean
    Dim pct As StdPicture
    Set pct = pb.Picture
    HasPicture = ((pct.Width > 0) And (pct.Height > 0))
End Function

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Private Sub Command1_Click()
    if picture1.picture=0 then
         msgbox "No Picture"
          msgbox "Picture already assigned"
    end if
End Sub

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.