Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 76
  • Last Modified:

Check textbox input for invalid entries

I have 2 textboxs that make a filename
txtName and txtAddress
I know there are characters or symbols that are not allowed in a filename
Example FileName:
John Doe 1124 Address.st
How can determine the wrong entries as they are typed and popup a message box
Call MsgBox(" These symbols not allowed: ????
0
isnoend2001
Asked:
isnoend2001
  • 3
1 Solution
 
Martin LissRetired ProgrammerCommented:
Would you rather want to prevent them from being entered in the first place?
0
 
Martin LissRetired ProgrammerCommented:
Try this.
Private Sub Text1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
    ' These are the characters "<>?[]:|*!" which aren't allowed
    Case 33, 42, 124, 58, 93, 91, 63, 62, 60
        Beep
        KeyAscii = 0
End Select
End Sub

Open in new window

0
 
isnoend2001Author Commented:
Thanks Marty, just what i needed
0
 
Martin LissRetired ProgrammerCommented:
Glad I could help.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now