devxlogo

The Latest

Unroll Loops to Optimize Your Code

A compiler can automatically optimize the code by unrolling loops. Consider this code: int *buff = new int[3]; for (int i =0; i

Refresh Component Displays

When you create the visual components that make up a user interface, their size and position are usually constant. However, it’s sometimes necessary to change a component’s size or position

Linking Radio Buttons to Objects

Question: I have a page with two drop-downs and two corresponding radio buttons. When I choose an item from one drop-down, I’d like the corresponding radio button to become checked.

Microsoft FrontPage Server Extensions

Question: I built a Web site for my company using FrontPage 98 and can not seem to upload it back to the Internet. I get error messages about server extensions.

Testing COM Interfaces at Run Time

VB5 provides interface inheritance through the use of the Implements keyword. For example, CFullTimeEmployee can implement the IEmployee interface. This interface might include basic information such as name, social security

Using Label Control as Splitter

Here’s a demo for using a Label control as a splitter between two controls, as well as sample code for employing the splitter in an Explorer-like application: Option ExplicitPrivate mbResizing

Always Use Case Else With Select Case

Select Case statements can lead to errors when the test expression in the Select Case line doesn’t yield a true result for any of its individual Case expressions. Therefore, you

Quicker Textbox Additions

Consider these two examples of code that add a string to a textbox. Example 1: Text1.text = Text1.text & MyString Text1.SelStart = Len(Text1.text) Example 2: Text1.SelStart = Len(Text1.text) Text1.SelText =

Use Windowless Controls for Performance and Economy

VB6 comes with an ActiveX control named MSWLESS.ocx (“Microsoft Windowless Controls 6.0”), which contains lightweight equivalents for these standard controls: WLTextWLFrameWLCommandWLCheckWLOptionWLComboWLListWLHScrollWHVScroll The controls have lower resource consumption than their regular

Using the Format Function With Strings

You’ll use the Format function most often with numbers, but it can be useful when applied to strings as well. For example, you can format a credit card number-which is

What are Plain Old Data (POD) Objects?

A POD (plain old data) object has one of these data types–a fundamental type, pointer, union, struct, array, or class–with no constructor. Conversely, a non-POD object is one for which

Add and Subtract Dates Using VBScript

VBScript has two functions for adding/subtracting dates or date values: DateAdd and DateDiff. For example: DateAdd(interval, number, date)DateDiff(interval, date1, date2 [,firstdayofweek[, firstweekofyear]]) Interval could be “yyyy” for Year, “q” for

Clean Up Project File Paths Before Sharing Source Code

As you work with a VB project, the project file–VBP–can become littered with relative path references such as “……..myfoldermyform.frm”. The project loads, but only on your machine. If you send

Avoid Unwanted Recursion From Event Cascades

Sometimes, an event might fire while it’s already executing from a prior invocation. To prevent this unwanted behavior, assign a static variable within the procedure, and test it before allowing

How Many Characters Fit in an Alert Box?

Question: How many characters can fit in an alert box? Answer: There’s no way to tell how many characters can fit in an alert box. The size of the dialogs

Modifying Enumeration Data Sources

Since the java.util.Enumeration class provides read-only access to the element list it represents, it may intuitively seem that the list of elements is immutable, or cannot be changed. However, the

Happy Hunting for ASP and Visual InterDev Bugs

Before you spend too much time bashing your head against a problem in Active Server Pages or Visual InterDev, check to see if you’re not up against an acknowledged bug.

Finding duplicate values in a table

Question: I have a table with the following fields: Physician Patient # Procedure One of the Procedures is “X-ray.” How can I list the Patient # of anyone who has

SplitTbl – Split a string with multiple delimiters

‘ A variant of the Split function, that offers the following improvements’ You can pass a list of valid delimiters to the second argument’ (however, only single-char delimiters are accepted)’

DataWindowChild problems

Question: I have a datawindow d_case with a retrieval argument al_case_id. In this datawindow, I have two columns that are ddlbcolumn1 = judge with dddw_judge and column2 = contact with

SQL Server Transaction log

Question: Is there a way to turn off the transaction log while importing data? We are having a problem with a 1105 error. Answer: You cannot turn the transaction log

Replace – String replacement under VB4 and VB5

‘ A clone of the VB6’s Replace function for use under VB5’ Note: many routines in this collection uses the Replace functionFunction Replace(Source As String, Find As String, ReplaceStr As

ReplaceMulti – Multiple string replacements

‘ Perform multiple substitutions in a string’ The first argument is the string to be searched’ The second argument is vbBinaryCompare or vbTextCompare’ and tells whether the search is case

Overriding Default Object Serialization

Normally, all that is required to perform serialization of an object is to implement the java.io.Serializable interface. However, in some cases, you may wish to control how an object is