Property Procedures vs. Public Variables

See Also

Property procedures are clearly such a powerful means for enabling encapsulation that you may be wondering if you should even bother with public variables. The answer, as always in programming, is "Of course — sometimes." Here are some ground rules:

Use property procedures when:

Use public variables for read-write properties where:

Note   Don't implement a property as a public variable just to avoid the overhead of a function call. Behind the scenes, Visual Basic will implement the public variables in your class modules as pairs of property procedures anyway, because this is required by the type library.

For More Information   The capabilities of property procedures are explored further in "Putting Property Procedures to Work for You."