devxlogo

Tip Bank

Bind Option Buttons to Data Controls

The Option button is a convenient way to display multiple options from which only one can be selected. One problem is that the Option button cannot be bound to a

Format Your Version Info

Many professional applications are required to display a version number on all screens to indicate to users which version of the app is currently running. This also helps with configuration

GetDirectorySize – Calculate the size of a directory

‘ Returns the size of the specified directory’ – Note: requires Imports System.IO’ – Usage: Dim DirSize As Long = GetDirectorySize(“D:Projects”)Function GetDirectorySize(ByVal DirPath As String) As Long Dim DirSize As

CopyDirectory – Copy a directory

‘ Copies a source directory to the destination directory.’ The last parameter specifies whether the files already present in the’ destination directory will be overwritten’ – Note: requires Imports System.IO’

LoadTextFile – Load the contents of a text file

‘ Returns the content of the specified text file’ Note: it can throw an exception’ Usage: Dim FileContent As String = LoadTextFile(“C:Autoexec.bat”)Function LoadTextFile(ByVal FilePath As String) As String Dim sr

Avoid Copying Data

You can use the name of a Function or Property Get procedure as a local variable anywhere in the procedure. If your procedure returns a String or UDT type, writing