Solved

UserControl - Property Set vursus Property Let?

Posted on 2006-07-07
6
527 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
  • 3
  • 2
6 Comments
 
LVL 65

Accepted Solution

by:
Jim Horn earned 125 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 65

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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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 125 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
MS Access - Capture pressed key onclick 4 42
MS Access Search and Replace Using VBA 6 85
VB6 - Convert HH:MM into Decimal 8 63
Visual Studio 2005 text editor 10 44
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

830 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