PBDR.COM

About   -   Contact   -   Purchase   -   Search   -   What's New

 
 
VB Short-Cut Keys

During development, navigating around multiple forms, modules and classes can be tedious, especially if you're unfamiliar with the code. Often, classes are instantiated with unintuitive object names, which bear no relation to their classes, and worse still functions and subroutines can be called which may exist in any of several modules, but as the module name is not used during procedures calls, locating them can be long winded.

Lucky there's a number of short cut keys to simplify these actions. Assume a function call exists as shown below:

    lblNoOfRecords.Caption = intGetRecordSetSize(rsMain) & _
      " record(s) found"

A quick method to locate the function intGetRecordSetSize is to double click the function which highlights the text and press SHIFT & F2, which immediately displays the module/class containing the required function, at the point where the function is coded. To return to the calling procedure, if SHIFT & F2 opened a new module/class then just close it down, however if the function called existed in the same form/module or class press CTRL & SHIFT & F2 to jump back to the calling procedure.

Debugging code activity lends itself well to any simplification on offer, as it's one of the less exciting development tasks. The obvious one is F8, which steps through code line-by-line, however the code often calls procedures which contain for...next, do...loop etc. which loop tens or hundreds of times through large recordsets, for example. To skip such procedures while stepping through code, as soon as debug mode steps into the undesired procedure press CTRL & SHIFT & F8, to jump over and return to the calling procedure at the next line of code.
Also while stepping through code, place the cursor on any line in the execution path and press CTRL & F8 to jump to that point. In both cases all the code 'jumped over' is executed but not in line-by-line debug mode.

The exception to this is to force the next statement line. As code is stepped through, at any point place the cursor on any line of code before or after the present line of execution and press CTRL & F9, to force a new point of execution. This method can be employed to avoid lines of code or to repeat lines of code (Note: this does change the expected path of execution and can affect the outcome of your code).

To break out of line-by-line debugging, press F5 to return to normal code execution.

 

Top of Page

Legal Notice

Ken Howe 2011