devxlogo

Tip Bank

Option Explicit

Many developers code text boxes to only accept numeric values. They usually forget about keyboard and mouse copy and paste functions. The following code only allows values 1 to 9

The Paint Protocol

The AWT Component.paint and Component.update methods take a Graphics object as a parameter. This object should not be retained, because it might be a transient object valid only during the

Create a List of Months

The following code creates an array with month names or populates a combobox or listbox with same = without all the typing: holdMonth(1) =

SetWallPaper – Change the desktop’s wallpaper

Private Function SystemParametersInfo Lib “user32” Alias _ “SystemParametersInfoA” (ByVal uAction As Long, ByVal uParam As Long, _ ByVal lpvParam As Any, ByVal fuWinIni As Long) As LongConst SPI_SETDESKWALLPAPER = 20′

SearchFileOnPath – Search a file on system path

Private Declare Function SearchPath Lib “kernel32” Alias “SearchPathA” (ByVal _ lpPath As String, ByVal lpFileName As String, ByVal lpExtension As String, _ ByVal nBufferLength As Long, ByVal lpBuffer As String,

Misuse of System.exit

The System.exit method forces termination of all threads in the Java virtual machine. This can be drastic. It might, for example, destroy all windows created by the interpreter without giving