devxlogo

The Latest

Overloading the Subscript Operator the Right Way

It is customary to overload the subscript operator, [], in classes that hold a sequence of elements. Vector and String are examples of such classes. When you overload operator [],

Use Refresh, Not DoEvents

When executing code and tying up the system, developers often use a label or status bar to display messages. If you simply assign your text or message to the control

Be Careful When Mimicking Tool-Tip Help

Be careful about tips to easily duplicate tool-tip help with only tip control and mouse events. If your “tip” control doesn’t have the same parent as the control you’re moving

Put Your Check-Box Value Into Your Database

Jeremy Boschen pointed out an easy way to load a Boolean into a check-box control in the tip, “Use Boolean Variables for Check-Box Values” [101 Tech Tips for VB Developers,

Add a Drop Shadow in IE4 or IE5

The latest versions of Internet Explorer (4.0 and 5.0) make it easy to add a dramatic drop shadow effect to regular text. Rather than creating bitmaps, try adding a style

Inserting Quotations in Name to Table Column

Question: Is it possible to insert the single quote as part of a Name like O’Brian into a table using a SQL Insert Statement? Answer: Yes, use double quotes around

Deletion Problem

Question: Is there an option to set deletion without getting logged? I have to delete two years of historical data but would like to keep this year’s data on my

Compiling an MSC/C++7.0 Source Code

Question: I’m using MSC/C++ 7.0 to write a program for my Foxpro 2.5. How can I compile it to the Foxpro’s PLB format? Answer: You need the Foxpro LCK (Library

SQL Select Statement

Question: In a SQL Select statement:Is it possible to define ORDER BY (random) Answer: The answer to your question is “no”. The ORDER BY clause must refer to specific fields

Drop an Index From a Table Using SQL

Question: How would I drop an index from a table using SQL? Answer: Here is the syntax for the drop index command: DROP INDEX [owner.]table_name.index_name[, [owner.]table_name.index_name…]Ex. DROP INDEX authors.au_id_ind Related

Variable Not Found Error on Read Statement

Question: In FPW 2.6 I often get a ‘variable not found’ message when the read statement executes. This usually happens only the first time the screen is used in the

Idle Processing Time

Question: I wanted to find the copy files wait screen (where it shows a file jumping from one folder to another). How can I do this and what is it

Capturing the Output of a MS-DOS Program

Have you ever heard of redirected input or consoleapplications? Have you ever had the need to launch MS-DOS programs, wait for them toterminate, and then dump their output to screen?

Static Variables are slower than Dynamic ones

Referencing a static local variable in a procedure is 2-3 times slower than a regular local, dynamic variable; if you want to really speed up your procedures, convert all static

Manufacture a Missing value

Visual Basic doesn’t provide you with a means for creating a Missing value, a feature that in some cases would prove useful in order to simplify the syntax of calls

UseMnemonics property for bound Label controls

If your forms contain Label controls used to display data from a database, set their UseMnemonic property to False. In fact, if you leave this property to its default value

Items of ParamArray can be Missing

When using the ParamArray keyword within a procedure, always remember that when the procedure is invoked from elsewhere in the program one of the argument might be omitted, and you

Correct usage for binary compatibility settings

When working on an updated version of a COM component, you should always enforce Binary Compatibility in the Component tab of the Project Properties dialog box. When enforcing binary compatibility

Counting Bits

It seems that the only way to count the number of 1’s or 0’s in a binary value is creating a loop that iterates on all the 16 or 32

InstrLast – Find the last occurrence of a substring

‘ returns the last occurrence of a substring’ The syntax is similar to InStrFunction InstrLast(ByVal Start As Long, Source As String, search As String, _ Optional CompareMethod As VbCompareMethod =

Never use the End statement

There are a lot of risks involved in using End in VB programs: your databases might not be correctly closed, your objects are not correctly terminated, etc. You should always

Correctly set scrollbars’ width and height

You should always modify a vertical scrollbar’s width and a horizontal scrollbar’s height to conform to the display resolution. You can learn the suggested size (in pixels) using the GetSystemMetrics

Always run a component using Full-Compile

When testing a component in the IDE, always perform a full compilation. This ensures that VB checks the syntax of all the code in the component, which in turn guarantees

DirExists – Check that a directory exists

‘ Return True if a directory exists’ (the directory name can also include a trailing backslash)Function DirExists(DirName As String) As Boolean On Error GoTo ErrorHandler ‘ test the directory attribute