How to Set Object Properties at Run Time in VB6?

Wednesday, September 2, 2009 ·

In the previous posting you have learnt how to set object properties at design time, by clicking the object you want, then change/set the value of property in the properties window. In this posting I'll write how to set/change property value at run time (when program running). And also I'll give you a sample program (code).

Below is the syntax how to set an object property at run time:
Object.Property = Expression

For example:
Below statement will set Caption of lblName with "John Smith" at run time.
lblName.Caption = "John Smith"

However not all object properties can be set their values at run time, because some object properties can be set just at design time. In the next posting maybe I'll write lists of which object properties that can be set just at design time, which ones that can be set just at run time, and which ones that can be set both at design time and run time.


0 comments:

Post a Comment