devxlogo

We are an award-winning tech entrepreneurship website where trusted experts can provide value globally.

Since 1998, DevX has helped people start businesses, build websites, and provide enterprise technology to people globally. Interviewing the likes of Microsoft’s co-founder, Steve Ballmer, the publication brings comprehensive, reliable, and accessible insights to the Internet.

devxlogo

Trusted for 26 years

Over 30K Articles

1M+ Readers

Expert-reviewed

10K+ Tech Terms

As seen in:

microsoft logo
business_insider_logo
wired_logo
berkley
arstechnica_logo
hackernoon

The Latest

A Smart ID Generator

I wrote a unique error-proof number generator that greatly simplifies the checking of clients’ accountnumbers or other IDs used by your application. I use it in conjunction with the CheckForValid

Shelling MS Internet Mail

If you are using the new mail program that can be downloaded for free from Microsoft’s Web site, you can run it from within your program. Simply add this command

Cheap Graphic Buttons

You can use the Wingdings font to put simple graphics on a standard command button. Put a standard command button on a form, and in the Properties window, change the

Hidden MDI Children

“Hide” an MDI child form with a non-sizable border style (0 or 1) using this code in the MDI child’s Form_Load event: form1.Move form1.Left, form1.Top, 0, 0 Use a label

Get/Put Arrays to Disk

The API functions “_hwrite” and “_hread” can be useful for writing arrays directly to files and, at some later time, reading these files directly into arrays having the same structure.

Refer to Columns in a DBGrid Control

Columns in a DBGrid control are bound to database fields. However, the index number of a column doesn’t tell you which field it represents. Therefore, referring to DBGrid1.Columns(0).Value is not

Addendum to “Remember SWAP?”

The tip “Remember SWAP?” [“101 Hot Tech Tips for VB Developers,” Supplement to the August 1996 issue of VBPJ, page 13] has a common error. This line actually creates three

Where Does It End?

When using the line-continuation character facility-the combination of a space followed by an underscore (_) used in the development environment to extend a single logical line of code to two

Dispelling Performance Myths

Omitting the counter from a Next statement does not speed up a For loop. Calling a procedure in a BAS module is not slower than calling a procedure contained in

Make Column Headers the Perfect Width

When you’re dynamically adding ColumnHeaders to a ListView control at run time, you may not know how long the text for the header will be, so the user must readjust

Use RLEs to Reduce EXE Size

Many programs use a splash screen to display the logo of the program. The logo is usually made by an image. You used to store it as a BMP (uncompressed)

Obtaining System Date Format

The DateCheck function is useful when you use the Masked Edit control for entering the date according to the system format. Some countries use the MM/DD/YYYY format, and other countries,

Trimmed to Fit

This piece of code trims long file names to fit into forms captions, text boxes, and other limited spaces. The code allows you to specify the number of characters a

Prevent Unwanted Recursion

A bug affecting the Sheridan 3D Controls appears in VB 4.0a. I don’t believe it was in 4.0, and I am certain it was not in 3.0. In any case,

“File Exists?” Revision

To adapt the tip “File Exists?” (see “101 Hot Tech Tips for VB Developers,” Supplement to the August 1996 issue of VBPJ, page 7) to a directory list box, it

Long File Names Can Be Confusing

If you want to open Paint with a file from your application, it’s better to convert the path of the file you want to open from long to short names.

Calculate Age Using DateDiff

Use the function DateDiff to calculate an individual’s exact age based on birth date. DateDiff first calculates the total number of days an individual has been alive and then divides

Clear the Clutter

Provide your users with a quick way to clear their “messy desktop” of extraneous forms by dropping this code into the Click event of a command button: For Each Form

Please Stop Printing!

Sometimes I want to print data from a recordset to a report, reading and printing each record. However, it’shard to interrupt that process before it sends all recordsets to the

Evaluating Elapsed Minutes

You might need to keep track of the total minutes between one date or time and another. To get the totalminutes, use a line like this: lTotalMinutes = Minutes(Now) –

Show an Hourglass When Processing Data

Have you ever forgotten to add code to set the MousePointer back to its default at the end of a procedureor function? This technique simplifies showing and resetting the MousePointer

Current Computer Name on Windows 95/NT

You often want to know the name of the current computer running Windows 95 or Windows NT in your VB program. Use this simple wrapper function of a kernel32.dll API

Show Fonts as you Select Them

To let a user change a font name, load all the fonts into a combo box: Private Sub Form_Load() ‘ Determine the number of screen ‘ fonts. For I =

Shortcuts for the VB Environment

1) In VB5, pressing Ctrl-F3 when the cursor is over a word automatically searches to the next occurrenceof that word, bypassing the search dialog. You need to be past the

Get all Matching Files in a Directory Structure

Because this code doesn’t use an API, you can easily port it between 16- and 32- bit applications. TheDirWalk procedure lets you search an entire directory structure starting at whatever

Trap Right-Clicks on TreeView’s Nodes

The TreeView control gives your apps a good Windows 95 look and feel. However, the VB manual doesn’texplain how to trap the right mouse button in a node. The Treeview_MouseDown

Getting UserID on Windows 95 and NT

You often want to get the user ID of the current user on the machine running Windows 95 or Windows NT.Use this simple wrapper function of an API function to

Run VB Using the Sendto Menu

Adding a “Shortcut to VB.exe” and “Shortcut to VB32.exe” to your “Send To” menu lets you right-click onany VBP project and open it with your choice of VB4 16/32 or