473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Restrict use of special charecters

Shakss2
19
Hello,

I have a text box where I enter a name.
I want to restrict the users from using a ' symbol or " symbol or any other special charecter in that text box.

How can I achieve it?

its access FE and BE.

Thanks

Shaq
Feb 11 '08 #1
4 10084
Zwoker
66
This may be a too simplistic answer, but why can't you use an input mask and only allow normal A-Z and a-z characters?
Feb 12 '08 #2
ADezii
8,834 Expert 8TB
Hello,

I have a text box where I enter a name.
I want to restrict the users from using a ' symbol or " symbol or any other special charecter in that text box.

How can I achieve it?

its access FE and BE.

Thanks

Shaq
If you want to allow only Alpha, Numeric, or AlphaNumeric characters, use an Input Mask as indicated by Zwoker. If you wish to disallow specific characters, you can trap the Keystrokes in the Control's KeyPress() Event. As an example, the following code will not allow a ', ", ?, or @ character in an Invoice Number Field:
Expand|Select|Wrap|Line Numbers
  1. Private Sub txtInvoice_KeyPress(KeyAscii As Integer)
  2. Select Case KeyAscii
  3.   'do not allow a ', ", ?, or @ in the Text Box
  4.   Case Asc("'"), Asc(""""), Asc("?"), Asc("@")
  5.     KeyAscii = 0  'Cancel the Keystroke
  6.   Case Else
  7.     'allow Keystroke to be processed
  8. End Select
  9. End Sub
Feb 12 '08 #3
Shakss2
19
Hey,

Thanks a lot... that worked exactly the way i wanted it.

I have another post in this forum which was not answered yet.
"Excel report using old version of MS excel"

If you have a chance then pls look at it.

Thanks again.

Shaq
Feb 12 '08 #4
ADezii
8,834 Expert 8TB
Hey,

Thanks a lot... that worked exactly the way i wanted it.

I have another post in this forum which was not answered yet.
"Excel report using old version of MS excel"

If you have a chance then pls look at it.

Thanks again.

Shaq
You are quite welcome, when I get a chance I'll have a look.
Feb 12 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Desmond | last post by:
Can anyone tell me ho to get certain charecters to be displayed. When sending email with (') i get (\) instead. i.e. This dosen't work becomes dosen\t Is there some kind of escape key to get...
3
by: Paul | last post by:
Hi all, at present I I've built a website which can be updated by admin and users. My problem, I've combined "log in" and "access levels" to restrict access to certain pages, using the built...
7
by: Mindy Geac | last post by:
Is it possible to delete special caracters from a string and multiple spaces? When the input is : "a&*bbb cc/c d!d" I want the result : "abbb ccc dd" thnx. MJ <?php
28
by: gc | last post by:
Hi, What is the purpose of the restrict keyword? gc
1
by: Alex Smith | last post by:
Hi friends, I want to read all charecters of pdf file using char array. Thanks, Alex.
2
by: pemo | last post by:
In Harbison and Steele's book, they say that using 'restrict' allows functions like memcpy() to be prototyped like this: void * memcpy(void * restrict s1, const void * restrict s2, size_t n); ...
21
by: Niu Xiao | last post by:
I see a lot of use in function declarations, such as size_t fread(void* restrict ptr, size_t size, size_t nobj, FILE* restrict fp); but what does the keyword 'restrict' mean? there is no...
2
by: Ken Camann | last post by:
Hello! I am having trouble understanding certain aspects of restrict qualified pointers. I understand what they are in the simplest terms, but I want to get high performance and portability out...
0
by: copx | last post by:
Restrict keyword questions How far does the guarantee that an object is not accessed through another pointer go? I mean, all examples I have seen are simple stuff like: int f (int *restrict x,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.