Extract numerical values from text string
By: Unknown Date: 24/09/1998
File:

purgenumericinput.zip

Size:

549 bytes

Download now!

The purpose of this routine is to take a string of text (such as with a textbox) and extract a numerical value from it. let's say that you have a textbox in which people enter dollar amounts. Many users are likely to enter something such as $ 4,335.49 and expect calculations to be performed on it. The trouble is, the value of that string is 0 (zero), not 4335.49!

Using this function, a person would actually be able to enter a string like $4,335.49 or even 4335.49 dollars and still have the value returned as 4335.49. The function called PurgeNumericInput requires one argument. That argument is a string containing numbers with or without special characters.

Syntax

PurgeNumericInput(string)

Parameters

string: string with numeric values and text "garbage"

Type of data

Variant

Returns

A string containing only the numeric value

-

The function is contained in a module. You can cut and paste it in any program of yours.

Click Here!


Visual Basic Programming Zone is a website by Lorenzo Dalla Vecchia.
Webmaster's e-mail: webmaster@vbprogzone.cjb.net
Hosted by InWind: www.inwind.it