devxlogo

Tip Bank

Enhance the Replace Function

If you’re faced with a string that needs to have certain characters removed from it, use the Replace() function to make the problem more manageable. For instance, use this code

Write an IsTime Function

Use this function to determine whether a string represents a valid time: Public Function IsTime(sTimeArg As String) As Boolean IsTime = IsDate(Format(Date, “short date”) & _ ” ” & sTimeArg)End

Use Screen-Saver Passwords

When you write a screen saver in C and the Windows SDK, a static library (SCRNSAVE.lib) allows you to create custom dialogs to change and request the password. But in

Enhance the Trim Function

The Trim function has a serious shortcoming: It handles only space characters?not all the usual white spaces such as tabs, carriage returns, and line feeds. Instead of the standard Trim

Query Objects for Initialization State

In a large app, or even a small one, you can use Property Let and Property Get to make sure necessary variables and subsystems are initialized. This code is from

Functions Parse Command Lines

Handling multiple command-line arguments has always been ugly in VB, especially when some of the arguments are quoted because they contain characters such as spaces. For example, if you want

Position and Size Controls Using Keyboard

You can move controls using Ctrl with the arrow keys, and you can change control size using Shift with the arrow keys. The controls move or resize according to the

Use TreeView Control With Checkboxes

When the NodeCheck event triggers, you receive as a parameter the node that was checked. Say you need to do some validation and uncheck the node when there’s an error.