Solved

UserControl - Property Set vursus Property Let?

Posted on 2006-07-07
6
525 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

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…
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…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

803 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