Seven Steps to Improving Your VB Code
I teach Visual Basic. I love it. It’s been good to me, all the way back to VB3. VB usefulness is growing wildly, but why do actual VB coding practices seem to lag a bit?
Maybe it’s the utility that has 19 buttons framing the form because the beginner never learned menus? Maybe it’s the button code view that spans multiple screens?
The problem isn’t VB. With a few basic improvements, VB coders can produce better code.
I like to offer beginning VB coders seven basic improvements. Consider using these tips in your next coding project. I’ve tried to prioritize them by order of importance. Here goes!
1. Normalize the Interface: Follow Windows Interface Standards
This step should be first on your list because it’s the easiest to implement. Create a document in Word. What is the shortcut key for printing? Now open Excel. What is the shortcut key for printing? People learn applications more quickly when coders follow interface standards.
Beware of implementing unique keyboard shortcuts or of giving the "standard" shortcuts new meaning. Redefining Ctrl+P to be Pause...well, that’s unnatural to users who have been trained to use that for printing.
People like menus. Littering your form with stacked buttons only confuses people. Never adjusting tab order to go with the natural flow of your application is frustrating to us keyboard users. So where can you find interface standards?
The Windows Vista User Experience Guidelines have great information on Vista, which has some neat changes to the older standards.
Boring? So how do you sell a more natural-looking application? There are a lot of freeware and shareware programs out there. Study them. Study the Office products. Study Visual Studio. Create a chart of the basic interface elements. Note similarities. Challenge yourself to follow standards.