Keyboard Image Stupid Keyboard Tricks

Applies To

OS:
VB:
NT, 9x, 2000
5, 6

Many people don't realize that using the keyboard will make you a ton more productive than using a mouse to achieve the same goals.  This is particularly true for the Visual Basic IDE.  And even though most of the keyboard shortcuts are described in the help file, I see programmer after programmer using the mouse to do the keyboard's job.  All these shortcuts apply to VB6.  However, most of them will also work with VB5 and some will go even lower.  So without further delay, here is your guide to being more productive.  Later, check out the section on how to discover your own shortcuts.

Dim strEmployeeName as String
Dim lngEmployeeID as Long

When typing strEmployeeName you can save yourself a couple of seconds by typing strE and then pressing Ctrl-Space to signal Visual Basic to complete your variable.  That is right, VB will append mployeeName to strE, to complete strEmployeeName .  Pretty nifty, ha?  The reason this happens is because VB keeps all the variables, functions, subs, methods, etc... in memory and can pop them up  whenever necessary.  If you get into the habit of using this feature, you'll shave off hours from you development time just in a single week.

Place the cursor on a function name, then press Shift-F2 combination and it will take you to that function.

Press Ctrl-Shift-F2 and it will take you back.  These two combos have been there since the dawn of VB.

Have you ever lost the Project Explorer window?  Press Ctrl-R to bring it to life.

Do a quick save before running.  Press Ctrl-S.

Never select Start button.  Always do a Start With Full Compile.  Either press Ctrl-F5 or hold down the Ctrl key while pressing the Start button.  (Or as some of my less than competent co-workers call it:  The 'Play' button). 

Want to do a quick comment/uncomment of your code?  See this tip.

Do you want to quickly see the value of a variable?  Place a cursor on the variable and press Shift-F9.

To toggle a breakpoint, use F9.

Ctrl-A will select all the code in the Code Window.  BTW, if you didn't know this one, please pack up your copy of VB and return it to the store for a full refund.  You don't deserve to be a programmer.

Are you sick and tired of going to the Project menu and selecting Components?  Simply press Ctrl-T.

To bring up properties for any object in VB, press F4.  To bring up code, press F7 on any object.

 

How to discover your own keyboard shortcuts

Many people ask me: "How do you figure out all these keyboard shortcuts?"  Well, beyond the usual 'look on the freaking menu - the shortcuts are to the right' method, I also recommend the following highly complex but much more rewarding method.  An added bonus to this method is that you'll find the undocumented tricks as well.  Please follow the directions below: