|
-
Jul 14th, 2002, 06:30 PM
#1
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:
Public Property Let Picture(p As StdPicture)
UserControl.Picture = p
End Property
Public Property Get Picture() As StdPicture
Set Picture = UserControl.Picture
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
-
Jul 14th, 2002, 06:36 PM
#2
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:
Option Explicit
Public Property Get Picture() As Picture
Set Picture = UserControl.Picture
End Property
Public Property Set Picture(ByVal New_Picture As Picture)
Set UserControl.Picture = New_Picture
PropertyChanged "Picture"
End Property
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
Set Picture = PropBag.ReadProperty("Picture", Nothing)
End Sub
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
PropBag.WriteProperty "Picture", Picture, Nothing
End Sub
-
Jul 14th, 2002, 06:39 PM
#3
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
-
Jul 14th, 2002, 07:08 PM
#4
Frenzied Member
Well, actually, property let would work. You just have to add the Set keyword, like:
VB Code:
Public Property Let Picture(p As StdPicture)
[b]Set[/b] UserControl.Picture = p
End Property
Public Property Get Picture() As StdPicture
Set Picture = UserControl.Picture
End Property
'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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|