The Latest

DevX - Software Development Resource

Use The Most Specific Type Available

Instead of declaring an object As Object, use the specific object type, such as CTask. This improves performance by minimizing the OLE lookup requirements. Related Posts AssertionSET ARITHABORT ONHow to

DevX - Software Development Resource

Use

Use an ampersand (&) instead of a plus sign (+) when concatenatingstrings. Depending on the data type of the operands, using the plus signmay result in an addition. Related Posts

DevX - Software Development Resource

Watch What You Pass To Your OLE Servers

Don’t use any objects in the Visual Basic object library as parametersor return values for exposed properties or methods in public classes. Theseobjects are not intended to be used from

DevX - Software Development Resource

Minimizing The Number Of Repeated OLE Lookups

Use With…End With to minimize the number of repeated OLE lookups.This has the added advantage of not requiring the temporary substitutionobject. Related Posts Find the TLS Version a Vendor SupportsBlue

DevX - Software Development Resource

Optimize Label Creation

Place one label on your form, tailor its properties (such as left-alignand autosize), and copy and paste it to create the rest of your labels. Related Posts GitHub Analysis Shows

DevX - Software Development Resource

Initializing An In-Process OLE Server DLL

Start the in-process OLE server using a Sub Main procedure. Includeall server initialization code in the Sub Main procedure. Don’t show formsfrom the Sub Main procedure and don’t use the

DevX - Software Development Resource

Be Aware, It’s Not C!

VB developers that program with C language might be confused by a feature in the language. Consider thiscode: Dim x As IntegerDim y As IntegerDim z As Integer x =

DevX - Software Development Resource

Set All Object Variables To Nothing

Do set all object variables to nothing before ending the application.When the End statement is executed in the OLE client application, the OLEserver is shut down and the Terminate events

DevX - Software Development Resource

Raise Your OLE Server Errors

Don’t display errors from the OLE server. Instead, raise an error tothe client application. Use error numbers greater than vbObjectError +512 and less than vbObjectError + 5535. Values between vbObjectError

DevX - Software Development Resource

Use Backquotes Instead of Apostrophes

Often when using Transact-SQL, I want to capture comments from a user in a text box and send them tothe database. However, if the user types an apostrophe in the

DevX - Software Development Resource

Spread Upgrades Over the Network

I design VB applications for approximately 300 employees in a networked environment. It’s difficult to keepthose PCs up to date with the most current version of an app, so I

DevX - Software Development Resource

Swap Two Integer Variables

Use this algorithm to swap two integer variables: a = a Xor b b = a Xor b a = a Xor b Related Posts Time Zone ConversionJones escorted from

DevX - Software Development Resource

Close Your Windows the Windows 95 Way

Place this code in the declaration section of a module: Public Sub Win95Shrivel(xForm As Form) ‘ Sets the form’s window status to ‘ minimized xForm.WindowState = 1End Sub Call it

DevX - Software Development Resource

A Workaround for Bound Image List Controls

When an image list is referenced by another object such as a toolbar, you can only add images to the imagelist. VB doesn’t allow deletes or changes to the size

DevX - Software Development Resource

String Surprise

I was developing a CGI application that read a database and pieced together the fields into a string forrepresentation as an HTML form. The surprise came when I found how

DevX - Software Development Resource

Porting VB-Specific Objects to Access 8.0

Code portability is extremely important, especially now that VBA is available in so many products. Someproblems might occur if you want to use VB4 or VB5 code in Access 8

DevX - Software Development Resource

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

DevX - Software Development Resource

Speed OLE Server Calls

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

DevX - Software Development Resource

Be Careful When Terminating OLE Servers

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

DevX - Software Development Resource

Testing An In-Process OLE Server DLL

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

DevX - Software Development Resource

Evaluate Polynomials Faster

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

DevX - Software Development Resource

Change a Property in a Group of Controls

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

DevX - Software Development Resource

Quick Jumps to the Declaration Section

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

DevX - Software Development Resource

Round and Format the Easy Way

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”

DevX - Software Development Resource

A Form That Won’t Close

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

DevX - Software Development Resource

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

DevX - Software Development Resource

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,

DevX - Software Development Resource

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

DevX - Software Development Resource

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

DevX - Software Development Resource

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