Visual Basic 2008 Programming: Business Applications with a Design Perspective
Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9
Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Appendix A Appendix B Appendix C Home
Last change: February 13 2016 18:48:19.

 Chapter in PDF

Chapter 2: Visual Basic Programming Concepts
Last change: February 13 2016 18:48:07.


In earlier versions of VB, you might encounter code that was not explicit in its expression; however, it could still be acceptable to VB. This occurred because when VB encountered missing or unspecified elements in an expression, it filled in the blank by assuming a certain default element.
In the current version, VB allows defaults only under very strict conditions. After all, code with defaults is not very clear. The programmer might assume something while VB actually does something else; therefore, using defaults in code can cause errors that may be hard to uncover. Avoid using defaults in your code by all means.

Default Property Setting

Most objects have many properties. When an object is initiated, each of these properties is assigned with an assumed setting (value). This setting is referred to as the default setting of the property. For example, you may have already discovered that the default settings (values) of the Text property for the first label, button, and form are Label1, Button1, and Form1, respectively. In most cases, default property settings are the proper settings for your project. In addition, not all the properties of an object have significant bearings on the performance of the project. These default property settings are usually left untouched.

Last change: February 13 2016 18:48:10.