How 2?

Dear Xpert,

How do I find out that an entered text has other characters like !, @, #, $, %, ^, etc.

Reply as soon as possible.

Shireen:)
shireen_shabbirAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
deightonConnect With a Mentor Commented:
'Block there input using

Private Sub Text1_KeyPress(KeyAscii As Integer)

    Dim x As String
    x = Chr(KeyAscii)
    If InStr("!@#$%^", x) > 0 Then
   
        KeyAscii = 0
       
    End If

End Sub
0
 
shireen_shabbirAuthor Commented:
Edited text of question.
0
 
VbmasterCommented:
Something like this perhaps?

CharsToSearchFor = "!@#$%^" .. etc

For a = 1 to Len(String)
  If (Instr(CharsToSearchFor, Mid$(String, a, 1) >0) Then
    Call Msgbox("Aargh. Characeter found. Reboot now?")
  End If
Next

0
 
szzjjjCommented:
I think that vbmaster's answer is right.
0
 
smeggheadCommented:
Apart from the missing bracket... tut-tut.

JK
0
All Courses

From novice to tech pro — start learning today.