Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Aug 6, 1997



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Create Custom Properties For Forms or Class Modules

Have you ever wanted to push a variable onto a form without using a tag? Property functions let you create custom properties for forms or class models. Use PropertySet, PropertyGet, and PropertyLet statements to manipulate custom properties. For example, you want to send a key value to a form so that the key is there in time for an SQL query to use it in a condition. Include a variable declaration for the property as a form-level variable:
 Private msKey as String
Then add two procedures for PropertySet and PropertyLet for the form:
 Public Property Let GetKey(vNewValue)
	msKey = vNewValue
End Property
Public Property Get GetKey()
	GetKey = msKey
End Property
You can now set the property from elsewhere by using:
 Form1.GetKey = "David"
In your form, use the variable you declared for any usage in your code. Property Procedures can be a bit more complex. But, the point is that the VB4 has become much more adaptable to your needs. Customize it to fit.
Crescent Tech
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date