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

Constants and Read-Only Fields (Read-Only Members)

Apart from the variable types discussed in this chapter, there are two value storage types in Visual Basic, which at first glance seem rather similar, constants and read-only fields. These two value storage types are defined only once during your program’s lifetime, but they behave very differently under certain circumstances—and their contents are saved in completely different manners.

Before discussing the differences, let’s examine what they have in common. Read-only fields and constants are used in similar contexts: namely, when a value must be used at different places within a program. For example, you would probably use a constant to return the name of your program or the expiration date ...

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