O'Reilly logo

Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition by Harvey M. Deitel - Deitel & Associates, Inc., Paul J. Deitel - Deitel & Associates, Inc.

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

9.11. Const and ReadOnly Members

Visual Basic allows you to create constants—members whose values cannot change during program execution. To create a constant instance variable of a class, declare that member as either Const or ReadOnly. An instance variable declared as Const must be initialized in its declaration; an instance variable declared as ReadOnly can be initialized either in its declaration or in the class constructor. Const values must be initialized at compile time; whereas ReadOnly values are not initialized until runtime. Neither a Const nor a ReadOnly value can be modified once initialized.

Error-Prevention Tip 9.4

If a variable’s ...

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