VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "isNumericTest"
   ClientHeight    =   3030
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4800
   Icon            =   "Form1.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   3030
   ScaleWidth      =   4800
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton btnExit 
      Caption         =   "E&xit"
      Height          =   495
      Left            =   1493
      TabIndex        =   18
      Top             =   2400
      Width           =   1815
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Index           =   14
      Left            =   3240
      TabIndex        =   17
      Top             =   1920
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Index           =   13
      Left            =   1680
      TabIndex        =   16
      Text            =   "£"
      Top             =   1920
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Index           =   12
      Left            =   240
      TabIndex        =   15
      Text            =   "£300.25"
      Top             =   1920
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Index           =   11
      Left            =   3240
      TabIndex        =   14
      Top             =   1560
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Index           =   10
      Left            =   1680
      TabIndex        =   13
      Text            =   "€"
      Top             =   1560
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Index           =   9
      Left            =   240
      TabIndex        =   12
      Text            =   "€400"
      Top             =   1560
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Index           =   8
      Left            =   3240
      TabIndex        =   11
      Top             =   1200
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Index           =   7
      Left            =   1680
      TabIndex        =   10
      Text            =   ",."
      Top             =   1200
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Index           =   6
      Left            =   240
      TabIndex        =   9
      Text            =   "$2,123.95"
      Top             =   1200
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Index           =   5
      Left            =   3240
      TabIndex        =   8
      Top             =   840
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Index           =   4
      Left            =   1680
      TabIndex        =   7
      Text            =   ".E"
      Top             =   840
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Index           =   3
      Left            =   240
      TabIndex        =   6
      Text            =   "1.284829E10"
      Top             =   840
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Index           =   2
      Left            =   3240
      TabIndex        =   5
      Top             =   480
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Index           =   1
      Left            =   1680
      TabIndex        =   4
      Text            =   "$,."
      Top             =   480
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Index           =   0
      Left            =   240
      TabIndex        =   1
      Text            =   "$1,234.56"
      Top             =   480
      Width           =   1215
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "IsNumeric2 returns:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   -1  'True
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   195
      Index           =   2
      Left            =   3240
      TabIndex        =   3
      Top             =   240
      Width           =   1365
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Numeric Characters:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   -1  'True
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   195
      Index           =   1
      Left            =   1680
      TabIndex        =   2
      Top             =   240
      Width           =   1440
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Number:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   -1  'True
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   195
      Index           =   0
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   600
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Public Function isNumeric2(v As Variant, Optional strChars As String) As Boolean
 If CStr(v) = "" Then 'if nothing was passed
  isNumeric2 = False
  Exit Function
 End If
 Dim i As Integer
 For i = 1 To Len(CStr(v))
  Select Case Asc(Mid(CStr(v), i, 1))
   Case 48 To 57 '0 to 9 was found
    'these are good, don't do anything
   Case Else
    If InStr(strChars, Mid(CStr(v), i, 1)) = 0 Then
     isNumeric2 = False
     Exit Function
    End If
  End Select
 Next
 isNumeric2 = True
End Function

'Alternative way of writing isNumeric2()
Public Function isNumeric3(v As Variant, Optional strChars As String) As Boolean
 If CStr(v) = "" Then 'if nothing was passed
  isNumeric3 = False
  Exit Function
 End If
 Dim keyAsciiCodes(255) As Boolean 'an array of 255 booleans (1 for each KeyAscii char)
 If Not IsMissing(strChars) Then 'if strChars exists
  Dim j As Integer
  For j = 1 To Len(strChars)
   keyAsciiCodes(Asc(Mid(strChars, j, 1))) = True 'true means count is as a number
  Next
 End If
 Dim i As Integer
 For i = 1 To Len(CStr(v))
  Select Case Asc(Mid(CStr(v), i, 1))
   Case 48 To 57 '0 to 9 was found
    'these are good, don't do anything
   Case Else
    If keyAsciiCodes(Asc(Mid(CStr(v), i, 1))) = False Then 'character is NOT a number
     isNumeric3 = False
     Exit Function
    End If
  End Select
 Next i
 isNumeric3 = True
End Function

Private Sub btnExit_Click()
 Unload Me
End Sub

Private Sub Form_Load()
 Text1(2).Text = isNumeric2(Text1(0).Text, Text1(1).Text)
 Text1(5).Text = isNumeric2(Text1(3).Text, Text1(4).Text)
 Text1(8).Text = isNumeric2(Text1(6).Text, Text1(7).Text)
 Text1(11).Text = isNumeric2(Text1(9).Text, Text1(10).Text)
 Text1(14).Text = isNumeric2(Text1(12).Text, Text1(13).Text)
End Sub

Private Sub Text1_KeyUp(Index As Integer, KeyCode As Integer, Shift As Integer)
 Select Case Index
  Case 0 To 1
   Text1(2).Text = isNumeric2(Text1(0).Text, Text1(1).Text)
  Case 3 To 4
   Text1(5).Text = isNumeric2(Text1(3).Text, Text1(4).Text)
  Case 6 To 7
   Text1(8).Text = isNumeric2(Text1(6).Text, Text1(7).Text)
  Case 9 To 10
   Text1(11).Text = isNumeric2(Text1(9).Text, Text1(10).Text)
  Case 12 To 13
   Text1(14).Text = isNumeric2(Text1(12).Text, Text1(13).Text)
 End Select
End Sub