devxlogo

November 29, 2001

Generate a Relative Path Between Folders

You can use a Shell Light Weight API to generate a relative path by using this code: Private Declare Function PathRelativePathToW _Lib “shlwapi.dll” (ByVal pszPath As Long, _ByVal pszFrom As

Return the Fractional Part of a Number

No native VB function returns a fractional part of a decimal number. However, by subtracting the whole portion, obtained with Fix, from the original value, you can derive the fractional

Iterate Control Arrays Without Error

Control arrays are odd beasts in that they can have missing elements. The simplest way to iterate a control array uses this method: Dim i As IntegerFor i = Text1.LBound

Arrays With Non-Zero Lower Bounds

In VB.NET, you can use the System.Array class to create an array with non-zero lower bounds. To do this, use the System.Array.CreateInstance method: Array.CreateInstance(Type, Lengths(), LowerBounds( ) ).If the array

Instantiate an Object Inline

In VB.NET, you can instantiate a new instance of an object inline, making your code more compact. This example shows both versions: Imports SystemPublic Class Author Private fName As String