
Since 1998, DevX has helped people start businesses, build websites, and provide enterprise technology to people globally. Interviewing the likes of Microsoft’s co-founder, Steve Ballmer, the publication brings comprehensive, reliable, and accessible insights to the Internet.








I have developed this technique to use when I program long formulas. First, I declare descriptive variables for the mathematical elements. I prototype the formula using the digit “1” as
Use VB’s string-concatentation operator (&) to incorporate user input into SQL queries at run time. Assume, for example, that cboField is a combo box containing a list of fields in
Reading data into and out of a VB program is straightforward. Most folks use the Input and Put statements in a For…Next loop. However, this straightforward technique takes time. Because
If you want to use an ICO file as a mouse pointer, set the MousePointer property to 99-Custom. Then load the icon into the MouseIcon property: Text1.MouseIcon= LoadPicture(“c:vbiconselements_ earth.ico”) For
In reference to “Unregister a DLL with the Right Mouse Button in Win95” [VBPJ March 1996, page 72], I would like to suggest a tip that is much easier to
When you connect to remote servers, always use tables attached to theserver through Access. This will significantly speed up your retrievaltime. Once a table is attached to a remote server,
Variants take more memory and it’s slower to get/set their values thanother data types. Option 1 will run slower than Option 2. Option 1: Dim iLoop As Variant For iLoop
Get the Visual Basic Knowledge Base from Microsoft. It contains hundredsof ideas (with code samples). I use it daily to get my job done (and findout new things to try
MDI children can be hidden! Although VB doesn’t directly supportthis, you can use the ShowWindow API call to do so. A simple call likethis will do it: Declare Function ShowWindow
Contrary to popular belief, an MDI child does not need to be immediatelyvisible at load time. If the Visible property is set to False at designtime, the child will not
To prevent untrapped errors in VB, put an error handler in the codefor every control/form’s events. Unless you want more granularity, youwon’t need to trap errors in function or module
It’s best to load all shared (or public) VBXs, DLLs, and OCXs in theWindows system directory. Doing so prevents component conflicts betweenshared components that are loaded in the wrong places.
Here’s how to quickly evaluate an expression or variable: While indebug mode, use the Add Instant Watch dialog to quickly see the currentvalue of an expression in your code. Highlight
If a control gets lost on your form, you can select it by choosingits name from the drop-down list at the top of the properties window. Setits Left and Top
Although it is undocumented and illogical, using IIF requires you todistribute MSAFINX.DLL with your program.
When adding a large number of items to a list box, you can greatlyspeed up the process by disabling redraws of it. A quick call to SendMessagedoes the trick. Sandwich
If you’re running into a roadblock in a particular section of yourprogram, step back and take another look at what you’re doing. There’sa good chance you’re using the wrong tool
You can drop labels and frames out of your application (and their accompanyingresource and memory usage) by writing a small routine to use Print andLine that draws directly onto your
You can make a beautiful gauge by combining two MicroHelp controls.Place a Mh3d control onto your form and set the inner bevel just insideof the outer bevel. Place a Mh3dCommand
When setting focus to another control, the DataCombo in Sheridan’sData Widgets can be forced to validate the text portion against its listby referencing the DataCombo’s IsItemInList property as follows: If
Use the shortest data type you can for variables. If you’re going tobe counting in a loop from 1 to 10, for instance, use an Integer not aDouble.
One of the great unsung heroes in MicroHelp’s VBTools is the Mh3dCalendarcontrol. Place a hidden calendar control on one of your main forms. Withthe .Day, .Month, .Year, and .DateFormat properties,
If you’re using LostFocus events but would also like to set the Defaultor Cancel properties for command buttons, you’ll run into a confusing situation.Those properties trigger the Click event when
Data is sorted by using the “ORDER BY” clause in a SQL statementand then assigning the SQL statement to the RecordSource property of thedata control that the DataGrid is bound
Yes, these shortcuts are in the manual, somewhere, but it’s helpfulto brush up on them. Using keystrokes is usually faster than using themouse to do the same thing. Photocopy these
Ever wanted a floating toolbar? To make one form “owned”by another, all it takes is a simple API call. Afterwards, the owned formwill float above the form that owns it,
I use bounded text boxes within the picture control but they act asif they belong to the form. Here’s how to make them act as if they belongto a container
Larger bitmaps used for .ListPicture/ListPictureSel properties in Mh3DListconsume proportionally larger amounts of resources. Also, avoid using 256-colorbitmaps in controls–they too consume more resources.
It’s not widely known that you can use CTL3D.DLL (or CTL3DV2.DLL) togive your VB forms the same 3-D look of Microsoft’s Office suite of applications.First, your app must register with
You can highlight a block of text in the code window and press theTab key to indent the block or Alt-Tab to unindent it.