- A Simple Temperature Conversion Program
- Building a Temperature Class
- Putting the Decisions into the Temperature Class
- Using Classes for Format and Value Conversion
- A String Tokenizer Class
- Classes as Objects
- Class Initialization
- Classes and Properties
- Another Interface Example·The Voltmeter
- A vbFile Class
- Programming Style in Visual Basic
- Summary
Programming Style in Visual Basic
You can develop any of a number of readable programming styles for VB. The one we use here is partly influenced by Microsoft's Hungarian notation (named after its originator, Charles Simonyi) and partly on styles developed for Java.
We favor using names for VB controls such as buttons and list boxes that have prefixes that make their purpose clear, and we will use them whenever there is more than one of them on a single form.
Control | Prefix | Example |
---|---|---|
Buttons | bt | btCompute |
List boxes | ls | lsSwimmers |
Radio (option buttons) | op | opFSex |
Combo boxes | cb | cbCountry |
Menus | mnu | mnuFile |
Text boxes | tx | TxTime |
We will name classes in ways that describe their purpose and only precede them with clsXXX if there is any ambiguity. We will not generally create new names for labels, frames, and forms when they are never referred to directly in the code. Even though VB is case insensitive, we otherwise will begin class names with capital letters and instances of classes with lowercase letters. We will also spell instances and classes with a mixture of lowercase and capital letters to make their purpose clearer.
swimmerTime