Tip Bank

DevX - Software Development Resource

Compact Your Code Using IIF and Switch

You can often replace an If…Then…Else block with a more compact IIf function: ‘ returns the max of two valuesmaxValue = IIf(first >= second, _ first, second) Switch is a

DevX - Software Development Resource

Combine Default with Other Attributes

When building an ActiveX control, you can set a default property or method using the Procedure Attributesdialog box, after clicking on the Advanced button. However, if your default property also

DevX - Software Development Resource

AutoSelect Text Box Contents

Users often find it faster to retype the entire contents of a text box rather than position the cursor within the data, and then edit the data. This is especially

DevX - Software Development Resource

More Versatile Array Parameters

You can write a single procedure that accepts any type of array as an argument by using a variantparameter. Within the procedure, address the array using the usual syntax: ‘

DevX - Software Development Resource

Easy CR/LF Padding

When I write text in message boxes, labels, and so on, and I need to include a carriage return/line feed, I use this function, passing it the number of CR/LFs

DevX - Software Development Resource

The Address of a Variable

THE ADDRESS OF A VARIABLEVB5 includes a built-in VarPtr function (see tip “Use the Object Browser to Discover UndocumentedFeatures”), but this function isn’t available in VB4. The VB4 runtime library

DevX - Software Development Resource

Cross Midnight Benchmarks

Traditionally, VB programmers benchmark their code using the Timer function. However, if your processmight terminate on the following day, you must take into account that the value returned by that

DevX - Software Development Resource

App.Path Might Return UNC Path Specifications

Unlike VB4, VB5””””s App.Path property might return a UNC path, such as “\serverprograms…”), undercertain circumstances, depending on how the program started and if it””””s interpreted in the VB IDE orcompiled