|
-
Dec 19th, 2008, 05:04 PM
#1
Thread Starter
PowerPoster
[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
-
Dec 19th, 2008, 07:49 PM
#2
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
-
Dec 21st, 2008, 06:50 AM
#3
Thread Starter
PowerPoster
Re: about image property in VB6
 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
-
Dec 27th, 2008, 11:34 AM
#4
Re: [RESOLVED] about image property in VB6
Good catch. Though you should probably change the .Image to .Picture also in the .WriteProperty line.
-
Dec 27th, 2008, 11:49 AM
#5
Thread Starter
PowerPoster
Re: [RESOLVED] about image property in VB6
 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.
-
Dec 27th, 2008, 01:52 PM
#6
Thread Starter
PowerPoster
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
-
Dec 27th, 2008, 09:36 PM
#7
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.
-
Dec 28th, 2008, 05:58 AM
#8
Thread Starter
PowerPoster
Re: [RESOLVED] about image property in VB6
 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
-
Dec 28th, 2008, 10:59 AM
#9
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.
-
Dec 28th, 2008, 03:03 PM
#10
Thread Starter
PowerPoster
Re: [RESOLVED] about image property in VB6
 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
-
Dec 28th, 2008, 04:27 PM
#11
Re: [RESOLVED] about image property in VB6
No, use Let. Set is used for Objects.
Set myFont = [font object] << Set
myFont.FontBold = True << Let
-
Dec 28th, 2008, 04:40 PM
#12
Thread Starter
PowerPoster
Re: [RESOLVED] about image property in VB6
 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
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
|