|
-
Jun 21st, 2002, 05:50 AM
#1
Thread Starter
G&G Moderator
ActiveX BackColor/ForeColor Properties
Hello all,
Im just starting ActiveX Programming and i was wondering how to make a BackColor and ForeColor Property for the "Label" Type Control. Ive Got Font fine, but BackColor isnt working. Ive tried;
Public Property Get BackColor() As OLE_COLOR
Set BackColor = UserControl.Label.BackColor
End Property
Public Property Set BackColor(ByVal New_BackColor As OLE_COLOR)
Set Label.BackColor = New_BackColor
PropertyChanged ("BackColor")
End Property
Get and Object Required Error but it is highlighting BackColor in the Property Get sub.
Help
«°°phReAk°°»
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Jun 21st, 2002, 10:00 AM
#2
The Backcolor property isn't an object so you can't use set, both inside the sub and use Let instead of Set in the declare section. Like this:
VB Code:
Public Property Get BackColor() As OLE_COLOR
BackColor = UserControl.Label.BackColor
End Property
Public Property Let BackColor(ByVal New_BackColor As OLE_COLOR)
Label.BackColor = New_BackColor
PropertyChanged ("BackColor")
End Property
Last edited by Edneeis; Jun 21st, 2002 at 10:04 AM.
-
Jun 21st, 2002, 10:31 AM
#3
Thread Starter
G&G Moderator
Thanks Edneeis, i got that. If you could, Explain Let Get and Set differences?? WHat i use each one for. Thanks heaps,
«°°phReAk°°»
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Jun 21st, 2002, 10:46 AM
#4
Sure, GET is used when your property data is being retrieved FROM your property (i.e. anytime you use x=MyProperty).
LET is used when data is being assigned TO your property (i.e. MyProperty=x) and SET is used with or in place of LET but only when you are dealing with Objects (i.e. Set myProperty=x). So if the property is an object like StdPicture, TextBox, Class Module... then you use Set otherwise you use Let.
-
Jun 24th, 2002, 05:38 AM
#5
Thread Starter
G&G Moderator
Thanks alot Edinees, youve helped heaps, now i understand it all.
«°°phReAk°°»
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Jun 26th, 2002, 09:16 PM
#6
New Member
Use "Set" when working with objects, not properties... hth
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
|