August 7, 1997

Avoiding Copy and Paste Functions in a Text Box

Copy (Ctrl+C) and Paste (Crtl+V) functions are already includedin a text-box control, but what if you want to avoid these functions?You might suppose that you can handle Ctrl key combinations withthe KeyDown event, but Crtl+C and Ctrl+V are not detected in theKeyDown event. The answer is to capture these key

To Flash or Not to Flash

Often, to create status-bar help, you place code in the mouse-moveevent procedures of controls to place text describing the controlon the status bar. Every time you update the text property, thecontrol repaints. Because the mouse-move event will fire many times over one control,the repainting causes flashing. To avoid the strobe

JET 3.0 Query Optimization, Get with the Plan

If you need to analyze the performance of a Jet 3.0 query by thequery execution plan, you may do so by adding this registry keyand running regedit: \HKEY_LOCAL_MACHINESOFTWARE\_ MicrosoftJet3.0EnginesDebug For the new Debug key, add a name value of JETSHOWPLAN (all capitalletters) and a data value of ON. Jet will

Use Multiple Object Types to Reduce Duplicate Code

In the “Determine the Class of YourObject with the TypeOfStatement” tip, the Desk and House objects have many propertiesin common. Instead of duplicating code by having a separate Printmethod for each object, we can write a generic routine to handleprinting of each object type. Note that the advantage of thisimplementation

ListView Column Sorting

vGive your ListView control in report view the sort functionalityof the Win95 Explorer. This code will allow you to sort by anycolumn. If your list is already sorted by the column header youpress, the sort order is toggled: Private Sub ListView1_ColumnClick_ (ByVal ColumnHeader As ColumnHeader) With ListView1 ‘If current sort

Application Path Inconsistency

Be aware that when using the Path property of the Applicationobject (App.Path), if your EXE is run from the root directoryof a drive, App.Path will return the drive letter and a backslash(C:), while an EXE in a subdirectory returns only the directoryname (C:DIR). Your application should, therefore, test for thepresence

Remove that Move!

Sometimes it is desirable to prevent a user from moving a form.A little known feature of Windows is that for any form, functionalitythat doesn’t appear in the control menu (ControlBox in VB terms)is not available to that form. Therefore, remove the Move commandfrom that form’s control menu to prevent a

Use Code Profiler for Debugging

Sometimes a runtime error only manifests itself after an EXE ismade and not in debug mode. This can be hard to track down, evenwith message-box statements. Use the code profiler add-in to findthe offending line of code. Following these steps should leadto your error: First back up your code. Select

No more posts to show