Function FilterKeyDown(Key as string, optional tmpText as string,optional NoMinusSign as boolean=true,optional NoDecimal as boolean=false) As boolean
dim tmpResult as boolean=true
select case asc(key)
case 48 to 57 'Number
tmpResult=false
case 8 'BackSpace
tmpResult=false
case 13 'Enter
tmpResult=false
case asc(".")
if NoDecimal=false then
if CheckCharExsit(key,tmptext)=false then
tmpResult=false
end if
end if
case asc("-")
if NoMinusSign=false then
if CheckCharExsit(key,tmptext)=false then
tmpResult=false
end if
end if
case 127 'Del
tmpResult=false
case 28 to 31 'Arrow Key
tmpResult=false
case 27 'Esc
tmpResult=false
end select
Return tmpResult
End Function
Private Function CheckCharExsit(tmpChar As String,tmpText as string) As boolean
Dim intX As Integer
Dim tmpResult As Boolean=false
if len(tmpText ) >0 then
For intX = 1 To Len(tmpText)
If tmpChar = Mid(tmpText, intX, 1) Then
tmpResult = True
Exit For
End If
next
end if
return tmpResult
End Function