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.
‘ Strip all control characters (ASCII code < 32)'' If the second argument is True or omitted,' CR-LF pairs are preservedFunction StripControlChars(source As String, Optional KeepCRLF As Boolean = _
‘ Return the next occurrence of a whole wordFunction InstrWord(start, Text, search, compareMethod) As Long Dim index As Long Dim charcode As Integer ‘ assume the search fails InstrWord =
‘ Replace a whole wordFunction ReplaceWord(Source As String, Find As String, ReplaceStr As String, _ Optional ByVal Start As Long = 1, Optional Count As Long = -1, _ Optional
If you execute a SQL statement in a stored procedure after your use the RAISERROR command, you will clear @@ERROR. This is true even if you use a RETURN and
Beginners are sometimes stymied when they get error messages on code that works perfectly elsewhere. For example, this code produces the error message, “Cannot use parentheses when calling a Sub”:
I often go to a site, scroll to the bottom, and see when it was last modified. If it says “March 1, 1825” then I am usually not so confident
Question: I want to create a three-tier application that has a browser front end and a Visual Basic middle-tier. How do I access my VB code from ASP? Should I
Question: I am trying to set up a recordset from the results of a form. On the ASP page, I have set a variable to the entry from the form
Question: We have an ASP page that displays product information from a database. We also have a button to download/view a related PDF file that should only appear on the
Question: I have data (text + CR + LF) stored in SQL Server 6.5 as a TEXT data type. When I want to display the data on an ASP page,
import java.util.*;import java.io.*;class Class1 { static Vector split(String string,String delimiter) { //StringTokenizer that works with empty strings boolean wasDelimiter=true; String token=null; Vector vector=new Vector(); if(string!=null) for(StringTokenizer stringTokenizer=new StringTokenizer(string,delimiter,true);stringTokenizer.hasMoreTokens();) { if((token=stringTokenizer.nextToken()).equals(delimiter))
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
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.
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
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
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
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
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,
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
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
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
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
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
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
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
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
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
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
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
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











