The Latest

DevX

Determine Which Controls are on a Form

Question: Is there a simple way to ascertain the names of all the controls on a particular form at run time? Answer: Every TComponent descendant has two properties, ComponentCount and

DevX

Troubleshooting Setup.exe errors

Question: I am trying to create a setup.exe for VFP 5.0, using the setup wizard. After I installed the application using the setup.exe and ran the program, I got error

DevX

Paradox Lock Files

Question: I have a Delphi 3 application running on a Novell network, that uses Paradox tables. For some reason, some of the users get the following message every once in

DevX

Cumulative Summary in SQL

Question: I need a summary-select which summaries cumulative values. This one works in Microsoft Access: SELECT s.nl_item_id, s.nl_value, ( SELECT sum(sub.nl_value) FROM TABLE1 sub WHERE sub.nl_item_id

DevX

Fire File Deletion From Inside ASP Page

Question: Is there any way to fire a file deletion from inside an ASP page while the page is being unloaded? I am creating a file on the fly using

DevX

Typecast Text to LPARAM

Question: How do I typecast text to LPARAM? LPARAM is supposed to be an integer, but clearly the API call wants text. I’m assuming I missed some pchar>string or pointer

DevX

Directory Browsing

Question: When the browser is pointed to a directory with no default HTML page then, in most cases, it shows the directory contents. Is it possible to create an HTML

DevX

Speed Up Run Time

Question: My executable takes almost a minute to run. How can I speed up the process? I am not running any queries at this point?I wait until I actually show

DevX

Put a Variable in a SQL String

Question: How can I put a variable in a SQL string? For example: input:=edit1.text;query1.sql.add(‘select * from address where name like ‘); Answer: Since SQL.Add takes a string, all you need

DevX

Create an Invoice

Question: I need to create an onscreen invoice. I can figure out Supplier name, Customer name, and so on. But I can’t figure out how to do the body?for example,

DevX

String to Float

Question: How do I add two label values together and submit the answer to another label? Label19.Caption := FloatToStrF(Table1Standard.AsFloat,ffCurrency,15,2)Label20.Caption := FloatToStrF(Table1Zero.AsFloat,ffCurrency,15,2)Label21.Caption := StrToFloat(????????? Answer: This is one of those things

DevX

Convert Delphi to C++?

Question: How can you convert Delphi to C++? Answer: I don’t know of any conversion tools out there that do this, though I could be wrong. If you’re using both

DevX

OverwriteHandler – A class for handling overwrite mode

‘———————————————————‘ OverwriteHandler class” you can associate this class to a form, using the’ Form property, and all the textbox controls in the’ form will support insert/overwrite mode switching” Usage: Dim

DevX

Polymorphic array procedures

You can create “polymorphic” routines that work with any type of array (except arrays of fixed-length strings, or UDTs) by using Variant parameters. Take for example the following code: Function

DevX

Use function name as a local variable

Many programmers don’t realize that it is perfectly legal to use the name of a function inside the Function itself, as if it were a local variable. This trick often

DevX

Quickly build a simple About form

If you need a quick-and-dirty About dialog box for your application, that maintains a consistent look with other Windows applications, look no further than the ShellAbout routine in SHELL32.DLL. Using

DevX

Return a Dos error code on exit

At times you may want to return a Dos ErrorLevel when closing your VB application. This can be necessary, for example, if the EXE is meant to be called from

DevX

Count How Many Items Have Been Selected

The SELECT element includes an options array that is accessible from JavaScript. You can use a loop to iterate through this array and count how many choices the user has

DevX

What is a Side Effect?

The Standard defines a side effect as a change in the state of the execution environment. Modifying an object, accessing a volatile object, invoking a library I/O function, or calling

DevX

Using “Sentry Bytes” to Detect Memory Overruns

One of the most frustrating aspects of debugging is detecting memory overruns. Some compilers (MS Visual C++ for instance) automatically add “sentry bytes” at the ends of every memory block

DevX

Use the Conditional Operator Judiciously

The conditional operator,?, is a shorthand for a sequence of if-else statements. Although it has legitimate uses, in many cases programmers tend to misuse it, thereby producing unintelligible and buggy

DevX

Perform Some Common Database Chores

These several database functions work together and perform various utility functions, such as checking if fields and tables exist, creating fields and tables, and so on. The interface hides all

DevX

Password Protect an Access Database

For simple Microsoft Access security, set the database password from the Security item under the Tools menu in Access, select Set Database Password, and enter a password. To use the

DevX

Generate Random Strings

This code helps test SQL functions or other string-manipulation routines so you can generate random strings. You can generate random-length strings with random characters and set ASCII bounds, both upper

DevX

Use Name Parameters With Oracle Stored Procedures

When executing an Oracle stored procedure, use the named parameter convention. In place of this code: OraDatabase.ExecuteSQL _ (“Begin Employee.GetEmpName (:EMPNO, :ENAME); end;”) Use this code:OraDatabase.ExecuteSQL (“Begin Employee.GetEmpName _ (empno=>:EMPNO,

DevX

Check Whether Password Includes a Number

Question: How can I check if the password that a user inputs has at least one numeric character? Answer: The best way to check whether what the user has entered