Results 1 to 3 of 3

Thread: How to check if Picture property is empty? (no image loaded)

  1. #1

    Thread Starter
    Addicted Member Michel Jr's Avatar
    Join Date
    Jan 2000
    Location
    Brazil
    Posts
    175

    Question

    Hello,

    I'm developing an OCX.
    I have 2 picture properties (PictureLeft and
    PictureRight).
    If the PictureRight is "empty" then I need to load the
    PictureLeft image on it.
    My question is: How can I verify if a picture property
    is empty (there is no image loaded on it)?

    I'm trying to use If PictureRight() = LoadPicture("") but
    it's not working.

    This is my code:

    Public Property Set PictureRight(ByVal New_PictureRight As
    Picture)
    Set m_PictureRight = New_PictureRight
    PropertyChanged "PictureRight"
    End Property

    Public Property Set PictureLeft(ByVal New_PictureLeft As
    Picture)
    Set m_PictureLeft = New_PictureLeft
    PropertyChanged "PictureLeft"

    If PictureRight() = LoadPicture("") Then '<== HERE is
    ' my problem
    Set PictureRight = PictureLeft
    PropertyChanged "PictureRight"
    End If
    End Property

    Thanks for any help.

    Michel Jr.

    [Edited by Michel Jr on 05-05-2000 at 07:00 AM]

  2. #2

    Thumbs up


    I got the solution

    If a picturebox or picture object contains a picture the then picture property contains a non zero value.
    if picture property = 0 means there is no picture.


    Now the modified code look like this



    Public Property Set PictureRight(ByVal New_PictureRight As
    Picture)
    Set m_PictureRight = New_PictureRight
    PropertyChanged "PictureRight"
    End Property

    Public Property Set PictureLeft(ByVal New_PictureLeft As
    Picture)
    Set m_PictureLeft = New_PictureLeft
    PropertyChanged "PictureLeft"

    If PictureRight.picture=0 Then '<== HERE is the solution
    Set PictureRight = PictureLeft
    PropertyChanged "PictureRight"
    End If
    End Property

  3. #3
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Use the Nothing keyword.
    Code:
    If PictureRight Is Nothing Then
        'the rest of the code
    End If
    Good luck!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width