Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

UserControl - Property Set vursus Property Let?

Posted on 2006-07-07
6
Medium Priority
?
541 Views
Last Modified: 2008-02-26
I am trying to create a OCX and am having trouble with setting the Properties. Can someone explain (with workong examples) the differences between using 'Property Set' and 'Property Let' ?

bdb
0
Comment
Question by:bdbrown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 66

Accepted Solution

by:
Jim Horn earned 500 total points
ID: 17058974
Property Set is when you are using an Object as a property (Recordset, Collection, etc.)

Property Let is when you are using a non-object as a property (Integer, Variant, String, etc.)
0
 
LVL 2

Author Comment

by:bdbrown
ID: 17059007
Thanks Jim for the clarification,
So how would I go about setting the background of my control to a different colour at design time and have it stay that colour when I run the app? Would that be a Object or non-Object property?
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 17059041
BackColor by itself is often a Long Integer, so that would be Property Let.

Some controls actually have a .Font object property which contains font, size, bold/italic/etc, which would be Property Get.

What control are you using?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 2

Author Comment

by:bdbrown
ID: 17059124
I am creating my own OCX control and want to make avalible some of these format and display properties at design time. When I open the form which the contol is placed, the values that I set at design time reset back to the default settings again. How can I assign default values and still allow the user to set properties at design?
0
 
LVL 22

Assisted Solution

by:danaseaman
danaseaman earned 500 total points
ID: 17063270
Sounds like you are not persisting the new values via PropertyBag  UserControl_ReadProperties and UserControl_WriteProperties. Without this your control will always use the default values or you need to set everything at run-time.

Take adantage of Vb Add-In "ActiveX Control Interface Wizard" which will set all this up correctly.
 
0
 
LVL 2

Author Comment

by:bdbrown
ID: 17081820
Dan; I am going to have to take some time to figure out this properties bag thing but I am sure the answer is in there.

Thanks for the help Jim and Dan - I have increased the points and will split between both of you.

bdb
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question