Results 1 to 12 of 12

Thread: [RESOLVED] about image property in VB6

  1. #1

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Resolved [RESOLVED] about image property in VB6

    i have these property:
    Code:
    Public Property Let Image(ByVal img As Picture)
        Set picView.Picture = img
        PropertyChanged "Image"
    End Property
    
    Public Property Get Image() As Picture
        Set Image = picView.Image
    End Property
    these property is working i need put it in UC properties events:
    Code:
    Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
        PropBag.WriteProperty "Image", Image, Null
    End Sub
    
    Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
        Image = PropBag.ReadProperty("Image", "")
    End Sub
    but i recive 1 error in:
    Code:
    Image = PropBag.ReadProperty("Image", "")
    error message: "Run-Time error '424': Object Required"
    why these error, can anyone help me resolve these error?
    thanks
    VB6 2D Sprite control

    To live is difficult, but we do it.

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: about image property in VB6

    Don't use Null, use Nothing in the Write. And in the Read, don't use "", use Nothing. Also don't forget to use the key word Set.
    Code:
    Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
        PropBag.WriteProperty "Image", picView.Image, Nothing
    End Sub
    
    Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
        Set picView.Image = PropBag.ReadProperty("Image", Nothing)
    End Sub
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: about image property in VB6

    Quote Originally Posted by LaVolpe
    Don't use Null, use Nothing in the Write. And in the Read, don't use "", use Nothing. Also don't forget to use the key word Set.
    Code:
    Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
        PropBag.WriteProperty "Image", picView.Image, Nothing
    End Sub
    
    Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
        Set picView.Image = PropBag.ReadProperty("Image", Nothing)
    End Sub
    thanks but both(us) have 1 error, that i found and resolved:
    Code:
    Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
        PropBag.WriteProperty "Image", picView.Image, Nothing
    End Sub
    
    Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
        Set picView.Picture = PropBag.ReadProperty("Image", Nothing) 'it's picture and not image, like i was thinking
    End Sub
    thanks
    VB6 2D Sprite control

    To live is difficult, but we do it.

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [RESOLVED] about image property in VB6

    Good catch. Though you should probably change the .Image to .Picture also in the .WriteProperty line.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: [RESOLVED] about image property in VB6

    Quote Originally Posted by LaVolpe
    Good catch. Though you should probably change the .Image to .Picture also in the .WriteProperty line.
    Code:
    Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
        PropBag.WriteProperty "Image", picView.Image, Nothing
    End Sub
    
    Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
        picView.Picture = PropBag.ReadProperty("Image", Nothing)
    End Sub
    
    Public Property Let Image(ByVal img As Picture)
        Set picView.Picture = img
        PropertyChanged "Image"
    End Property
    
    Public Property Get Image() As Picture
        Set Image = picView.Image
    End Property
    i'm sorry, but i think not. because the Image is read-only and the picture is write-only.(tell me if i'm not right).
    thanks
    Last edited by joaquim; Dec 27th, 2008 at 11:56 AM.
    VB6 2D Sprite control

    To live is difficult, but we do it.

  6. #6

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: [RESOLVED] about image property in VB6

    i'm sorry, but i found 1 problem in these property.
    when i do these:
    Code:
    Form1.Picture = LevelEditor2D1.Image
    works fine. but when i do these:
    Code:
    LevelEditor2D1.Image=form1.image
    i recive 1 error:
    "run-time '450': wrong number of arguments or invalid property asignmant"
    what isn't right?
    i'm sorry and thanks
    VB6 2D Sprite control

    To live is difficult, but we do it.

  7. #7
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [RESOLVED] about image property in VB6

    > PropBag.WriteProperty "Image", picView.Picture, Nothing < should not generate any error if there is a picture property.

    Regarding your runtime 450 error. Change your property parameters to stdPicture vs Picture

    Tip, when I code a property to receive a stdPicture or stdFont object, I usually use 3 property statements. This way if the user included the keyword SET or not, no 450 error is generated.
    Example:
    Code:
    Public Property Let Image(ByVal theImage As stdPicture)
         Set Image = theImage
    End Property
    Public Property Set Image(ByVal theImage As stdPicture)
         Set picView.Picture = theImage
    End Property
    Public Property Get Image() As stdPicture
         Set Image = picView.Picture
    End Property
    Last edited by LaVolpe; Dec 27th, 2008 at 09:40 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  8. #8

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: [RESOLVED] about image property in VB6

    Quote Originally Posted by LaVolpe
    > PropBag.WriteProperty "Image", picView.Picture, Nothing < should not generate any error if there is a picture property.

    Regarding your runtime 450 error. Change your property parameters to stdPicture vs Picture

    Tip, when I code a property to receive a stdPicture or stdFont object, I usually use 3 property statements. This way if the user included the keyword SET or not, no 450 error is generated.
    Example:
    Code:
    Public Property Let Image(ByVal theImage As stdPicture)
         Set Image = theImage
    End Property
    Public Property Set Image(ByVal theImage As stdPicture)
         Set picView.Picture = theImage
    End Property
    Public Property Get Image() As stdPicture
         Set Image = picView.Picture
    End Property
    it's working thanks. i'm sorry but can o give me how you do the font property. in here my problem is these property has some subproperties(fontname, fontsize and others). thank you very much
    VB6 2D Sprite control

    To live is difficult, but we do it.

  9. #9
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [RESOLVED] about image property in VB6

    For a complete font, just change stdPicture to stdFont.

    For the individual FontName, FontSize, etc. You have to supply separate Get/Let properties for each of those. Sorry.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  10. #10

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: [RESOLVED] about image property in VB6

    Quote Originally Posted by LaVolpe
    For a complete font, just change stdPicture to stdFont.

    For the individual FontName, FontSize, etc. You have to supply separate Get/Let properties for each of those. Sorry.
    i understand, but i need ask you something:
    for example: a have fontname and fontsize properties. and the font property.
    has you know the font property has very subproperties, and these subproperties values can be used for change the fontsize and fontname,right?
    and for these i use the SET property or other?
    thanks
    VB6 2D Sprite control

    To live is difficult, but we do it.

  11. #11
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [RESOLVED] about image property in VB6

    No, use Let. Set is used for Objects.
    Set myFont = [font object] << Set
    myFont.FontBold = True << Let
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  12. #12

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: [RESOLVED] about image property in VB6

    Quote Originally Posted by LaVolpe
    No, use Let. Set is used for Objects.
    Set myFont = [font object] << Set
    myFont.FontBold = True << Let
    thanks my friend.... thank you
    VB6 2D Sprite control

    To live is difficult, but we do it.

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