Results 1 to 4 of 4

Thread: Picture property...

  1. #1

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    Picture property...

    This must be dead simple, I just can't think of it. When making a Picture property for a usercontrol, when I try to set it, an error message box comes up saying 'Wrong number of arguments or invalid property assignment'. Here's what I am doing :
    VB Code:
    1. Public Property Let Picture(p As StdPicture)
    2.     UserControl.Picture = p
    3. End Property
    4. Public Property Get Picture() As StdPicture
    5.     Set Picture = UserControl.Picture
    6. End Property

    Can someone point out what I missed?

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  2. #2
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141
    Since you are working with an object you are going to have to go with a Property Get and a Property Set. Try something like this instead.
    VB Code:
    1. Option Explicit
    2.  
    3. Public Property Get Picture() As Picture
    4.     Set Picture = UserControl.Picture
    5. End Property
    6.  
    7. Public Property Set Picture(ByVal New_Picture As Picture)
    8.     Set UserControl.Picture = New_Picture
    9.     PropertyChanged "Picture"
    10. End Property
    11.  
    12. Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
    13.     Set Picture = PropBag.ReadProperty("Picture", Nothing)
    14. End Sub
    15.  
    16. Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
    17.     PropBag.WriteProperty "Picture", Picture, Nothing
    18. End Sub

  3. #3

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    D'oh, I knew it was simple.

    Thanks Mark

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  4. #4
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    Well, actually, property let would work. You just have to add the Set keyword, like:

    VB Code:
    1. Public Property Let Picture(p As StdPicture)
    2.     [b]Set[/b] UserControl.Picture = p
    3. End Property
    4. Public Property Get Picture() As StdPicture
    5.     Set Picture = UserControl.Picture
    6. End Property
    7. 'Propbag here

    This will eliminate the need to add the set keyword in front of the property (many controls do this).


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

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