Document Your OLE Servers
Document the interface for your OLE server by using the Options buttonin the Object Browser. To provide more full-featured documentation, usea help file. Use the Object Browser to tie the
Document the interface for your OLE server by using the Options buttonin the Object Browser. To provide more full-featured documentation, usea help file. Use the Object Browser to tie the
Pass as much data to and from the OLE server as possible in each call.Data transfer is fast, but calling is slow, especially with out-of-processservers. For example, you could pass
Don’t provide a method that terminates your server. Let the server automaticallyterminate when no references to the server exist. If you provide an Exitmenu option in an OLE server that
Test an in-process OLE server DLL by building it first as an out-of-processserver. This makes it possible to debug and test. Also, the stability ofthe entire application will be affected
The well-known Horner schema lets you calculate polynomial expressions efficiently. To calculate: A*x^N + B*x^(N-1) + . + Y*x + Z ( ^ means power ), simply write this expression
You can easily make a group of controls visible or invisible. At design time, select all controls you want tomake visible or invisible during the execution. Press F4, and assign
I often want to get to the General code section of a form quickly, either to hack module-level variables or tograb the procedure pull-down to find that function whose name
Do you sometimes need to format rounded numbers to a specific number of digits? You can accomplish thisin one step: n = 12.345Format(n, “0.00”)’returns “12.350”Format(n, “0.”)’returns “12.00”Format(0.55, “#.0”) ‘returns “.60”
If you set a form’s ControlBox property to False, the Minimize and Maximize buttons also become invisible.Suppose you want to provide functionality to the user to maximize and minimize the
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
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,
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
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
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
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
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
Related Posts New Add-in for Monitoring SQL Server Performance in Updated dbForge Developer BundleUnderstandng toExactInt method in java.lang.Math packageReport: 68% of Enterprises Sometimes Compromise Security to Speed App DeliveryReading
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
I like to use the Constant.txt file Microsoft has been kind enoughto provide. For a new project, copy Constant.txt to a new filesuch as MyConst.txt. Place MyConst.txt in the same
This code will prevent a beep when you hit [ENTER] or [TAB] ina text box whose maximum character limit has been reached: Sub Form_KeyPress (keyascii As Integer)’Eliminate beep if {ENTER}
In VB4 the TypeOf statement works with any valid object type,not just forms and controls. This allows you to pass objects ofdifferent classes to the same procedure for a class-specific
Here is a tip to help with missing or mispositioned text. Thisfailing code works fine with VB3: ClsPrint Spc(10); “Enter Your Name”;currentx = 0currenty = currenty + 1Print Spc(10); “Enter
A tip on page 48 of the March 1996 issue of VBPJ statesthat an ODBC error message occurs when using VB3 with the Access2.0 compatibility layer. An error occurs if
It is well known that VB3 is not always as conscientious as itshould be about unloading all the forms in an application whentheapplication terminates. Because unloading all the forms for
Just before performing your final ‘make EXE,’ switch your desktopcolor scheme and see just how many backgrounds you have hard-coded!(Sadly, several excellent shareware controls fail here, VBPJcontributors are guilty of
The Lost_Focus and Got_Focus events are the most-used events for implementing validation and texthighlighting. Wouldn’t it be nice to respond instantly to these events and to do it from a
Set the AutoRedraw property to True and the benefits and trade-offsinclude much faster repaints and some wasted memory. If your formis resizable, you waste a lot of memory, because the
Visual Basic doesn’t have a procedure like the DLookUp function that Access has. You can use thisprocedure in VB to receive the Name of an object by ID: Public Function
The ElasticForm subroutine, part of CodeBank’s standard procedurelibrary, automatically repositions and sizes all controls on anSDI form when the user or code resizes the form. To use the routine,simply lay
Because MDI forms don’t have a border property, the user can drag the borders and distort the size of theMDI form. If the user tries to resize the form, I