The Latest

DevX

Preventing “Invalid Use of Null” Errors

If your app uses database or other functions that can return Null variants,your app will crash sooner or later with that dreaded “Invalid Useof Null” error. Preventing it is simple:

DevX

In-Line Code

Calling a function or procedure incurs some overhead. If you have atwo-line function that is called from only three places, you might considerputting those three lines in the functions themselves

DevX

Use Specific Object Types

When passing controls as parameters, make the function that is receivingthe parameter accept the specific object type instead of generic types.The exception to this is when multiple types of objects

DevX

Set AutoRedraw to False

If AutoRedraw is set to True, VB keeps a bitmap of the form in memorythat it uses to redraw the form after another window in front of it isclosed. Because

DevX

Use VB’s Timer Function to Optimize Code

I often see questions in the VBPJ forum about comparative speedsfor different methods of performing actions in code. In many cases, a simplegeneralization of which is fastest cannot be made.

DevX

Clear Out Data When Unloading Forms

When unloading a form, use the following piece of code behind a Closebutton: Unload This code should also be put in the Form_Unload() event handlerfor that form: Set = Nothing

DevX

Use Read-Only Attributes When Sharing Code

If you set a VB file’s DOS attribute to read-only, VB will show itwith a red lock in the project window and prevent it from being overwritten.This is a handy

DevX

Using ALT+F4

Pressing Alt and F4 will close any window with a control box. Becauseyou can’t choose Alt and F4 as a shortcut key combination from the menudesigner, you must place it

DevX

Checking for a Previous Instance

When working in Windows, it is very easy to lose a minimized icon onthe desktop. Or you may forget you have an application running and tryto open it again from

DevX

Data Updating Speed

When updating the values of several records in a loop, put a BeginTrans,CommitTrans around the loop. This will significantly speed up the updateprocess: BeginTrans Do Until dsData.EOF dsData.Edit dsData!sState_cd =

DevX

Making the Enter Key Work Like a Tab

To allow the Enter key to function as a Tab, enter this code in theKeyPress event of your text boxes: Sub Text1_KeyPress (KeyAscii As Integer) If KeyAscii = 13 Then

DevX

Programmatically Selecting Multiple Rows in a Data Grid

To select multiple, nonconsecutive rows (a tagged list) in SheridanSoftware’s DataGrid (which is a part of its Data Widgets package), firstset the SelectionTypeRow property of the DataGrid to TagList. For

DevX

3-D Text Boxes in VB Pro

To create a 3-D text box, place a text box in a 3-D Panel and set thepanel’s AutoSize property to “Autosize Child to Panel.” Thenset the BevelOuter and BevelWidth properties

DevX

Using AutoTab with a Set MaxLength

To add AutoTab to text boxes that have a set MaxLength, add this codeto the text box Change event: Sub Text1_Change () If Len(Text1) = Text1.MaxLength Then SendKeys “{Tab}” End

DevX

Make Controls Appear 3-D

The latest trend in Windows programs is the use of a 3-D look thatmakes windows and controls appear to be three-dimensional. As a result,a number of tools for adding the

DevX

Optimize Code

I often see questions in the VBPJ forum about comparative speedsfor different methods of performing actions in code. In many cases, a simplegeneralization of which is fastest cannot be made.

DevX

A Handy Utility for Working with INI Files

If you work with INI files, save yourself hours of work and downloadthe INIFILE.BAS module I’ve uploaded to the VBPJ and MSBASIC Forumson CompuServe (file KPINI.ZIP). There’s no charge for

DevX

Testing for a Given File

There are lots of ways to test for whether a given file exists. Themost common method is to use the Dir$ function. If Dir$ returns a nullstring, then the file

DevX

Graphics in MDI Forms

To use a bitmap or other graphics in the client space of MDI forms,the only trick is getting the hWnd for that window so that you can useGDI functions on

DevX

Automatically Repairing Corrupt Databases

When you’re using VB’s built-in database functionality, you’re likelyto get a corrupted database sooner or later. Use this code to open yourdatabases and automatically repair any corrupt ones: On Local

DevX

Undo Changes in Text Boxes

Most professional applications have an Undo menu option under the Editmenu. If you want to have an undo feature for every text box, you may thinkyou need to create a

DevX

Show Free Resources

It is sometimes useful to determine the amount of Windows resourcesavailable. You can show percentage of free resources in an about box, forexample, or to detect memory leaks in a

DevX

Comments Don’t Increase EXE Size

VB strips comments out in the final .EXE file, so use as many commentsas you need. Related Posts Top IEO Marketing Companies: Strategies for a Successful LaunchCarta Layoffs Spark Financial

DevX

Help Search on the Menu Bar

Ever wanted to add a “Search for Help on…” item in themenu bar? Here’s the secret: ‘Declares and Constant for Help Menu Declare Function WinHelp% Lib “User” _ (ByVal hWnd%,

DevX

frames and cgi

Question: Is there a way to target dynamicly created html from a form in one frame to another using perl? Answer: Sure thing. Related Posts Convert a String to a