The Latest

DevX

Customizing a JComboBox

The JComboBox API provides a programmer with very little directcontrol over how list items are displayed. This is because, in trueobject-oriented fashion, a JComboBox object knows or cares very littleabout

DevX

Doing an [import java.package.*]

This tip is probably cosmetic, but it could result in great convenience. Doing a [import java.package.*] would allow usage of [public] classes in theaforementioned package without the usual required verbosity.

DevX

How to Format Numeric Values

At times you want to output the numeric values in specific format, for example, you may want to display monetary value with two decimal points, or scientific data with five

DevX

Java Applications and the “Current Directory”

A recurring question in the Sun Java Forum groups is, “How do Ichange the current directory of my Java application?” The correct answer is that you don’t! Java applications don’t

DevX

Keep HTML Totally Separate From Java Code

I have been working on Java Servlets and HTML for quite a long time and have always had a problem keeping HTML code separate from Java code, but now I’ve

DevX

Remove Unused Controls From Projects

If you usually load many controls into your VB project during development, you often have controls loaded that aren’t used any more by the time the project’s finished. If the

DevX

Multiply Conditions for Boolean Result

You often have to test for multiple conditions when enabling a confirmation button or other control that commits user input. Instead of using complex If…ElseIf statements or inline If functions,

DevX

Save Forms’ Size and Location at Run Time

You’ve noticed how some apps display forms and toolboxes in the same location and size as when you last closed them. Here’s some simple code that gives your VB app

DevX

Use an Easier Autohighlight Method

Most of us have a routine we call to autohighlight the entire contents of a textbox when it receives focus. And most of us type the name of the textbox

DevX

Test for Illegal Characters

Use this fast function to test for the occurrence of nonalphanumeric characters in a string: Private Declare Function StrSpn Lib “SHLWAPI” Alias _ “StrSpnW” (ByVal psz As Long, ByVal pszSet

DevX

Turn a Textbox or Label Into a Marquee

Sometimes you need to display information longer than the biggest textbox or label control you can have onscreen. I’ve written a routine that displays a textbox’s or label’s contents in

DevX

Format Names Consistently

People’s names come in many separate parts, some of which might not be present or known. The hassle begins when you’re dealing with a storage system?database or otherwise?where the parts

DevX

Wrap I/O for Text Files

In a production application, every time you want to access a file for reading or writing, you must retrieve a free handle using the FreeFile() function to ensure you don’t

DevX

Create a Safer Mid Function

If you often write complex string-parsing and manipulation algorithms, the last thing you want is to add more checks to ensure your string positions are not negative. Avoid the hassle

DevX

Account for Taskbars When Centering Forms

Most VB programmers must display a form centered on a screen. You can do this in a variety of ways, but most ignore aspects of the environment such as the

DevX

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

DevX

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

DevX

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

DevX

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

DevX

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

DevX

Use System Icons for MsgBox Look-alikes

When VB’s MsgBox function doesn’t provide everything you need, you have to create a message-box Related Posts What Are Effective Methods for Handling Large Data Sets?The Art of AI-Generated Meeting

DevX

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

DevX

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

DevX

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.

DevX

Treat a Form Like a Function

Some forms are merely dialog boxes that show something to the user and sometimes get something in return. For example, you might have to create a form that displays a

DevX

Julian (Ordinal) Date

Question: Is there an easy function to get the Julian (Ordinal) date of a date? For example 015 from 01/15/2000. Answer: Try subtracting December 31st of the previous year from

DevX

Netscape Does Not Support VBScript

Question: I recently rewrote my entire Web site using frames and VBScript to load the appropriate pages into the proper frame. My Web site looked fine in Internet Explorer, but

DevX

Assign Zero or NULL to a Pointer

Question: To initialize a pointer after deleting it, should I assign a NULL to it or zero? Are they the same in C++? I know strictly speaking, I should assign

DevX

Visual Basic 6.0 Versus Visual InterDev 6.0

Question: How does Web development with Visual Basic 6.0 and Visual InterDev 6.0 differ? Which tool is better for Web development and why? Answer: Both products can help you arrive