O'Reilly logo

Microsoft® Visual Basic® 2010 Developer’s Handbook by Klaus Löffelmann and Sarika Calla Purohit

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Properties

Objects and value types can have properties. Properties describe states that can be determined or changed. In contrast, methods typically perform a task. Even in everyday language, these things can’t always be separated very easily. Properties are very similar to methods. Setting a property initially corresponds to calling a method that doesn’t return a value, and reading a property corresponds to a function call to a method that returns a result.

For example, the length of a string is a property. Let’s start by declaring and defining a String variable, as follows:

Dim aName as String = "Adriana Ardelean"

You can then determine the string’s length (the number of characters it contains) by using the appropriate property, as shown here: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required