Solved

Check textbox input for invalid entries

Posted on 2014-11-26
4
64 Views
Last Modified: 2014-11-26
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
Comment
Question by:isnoend2001
  • 3
4 Comments
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40467110
Would you rather want to prevent them from being entered in the first place?
0
 
LVL 45

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 40467133
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
 

Author Closing Comment

by:isnoend2001
ID: 40467165
Thanks Marty, just what i needed
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40467173
Glad I could help.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now