devxlogo

Tip Bank

Use the Immediate If Function in VBScript

Visual Basic includes the Immediate If function (IIf), but VBScript (VBS) does not. However, you can copy this code to VBS to allow the IIf function to be used: ‘VB

Algorithms: A Linear Search

This is a very straightforward loop comparing every element in the array with the key. As soon as an equal value is found, it returns. If the loop finishes without

GetGreyScale – Convert a color to greyscale

‘ Convert a color to greyscale’ Example: Me.BackColor = GetGreyScale(Color.Red)Function GetGreyScale(ByVal col As Color) As Color Dim greyValue As Integer = CType(col.R * 0.3 + col.G * 0.59 + col.B