473,796 Members | 2,509 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

regularexpressi onvalidator so that user can't fiil spacebar

18 New Member
Hi all,
I have a problem in regularexpressi onvalidator. I need that user can not enter any spacebar into the textbox.
Mar 23 '07 #1
5 1373
keithmdennis
3 New Member
Do you mean you don't want any spaces in the TextBox input? Just numbers and letters and other characters?
Mar 23 '07 #2
prp
18 New Member
Do you mean you don't want any spaces in the TextBox input? Just numbers and letters and other characters?
yes i need only number in the textbox
Mar 23 '07 #3
keithmdennis
3 New Member
yes i need only number in the textbox
try this:

1. ^[-]?([1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|\\.[0-9]{1,2})$ for numbers with decimals.

2. ^[1-9]{1}$|^[1-4]{1}[0-9]{1}$|^1000000$ for integers between 1 and 1000000.

Is this what you were looking for?
Mar 24 '07 #4
prp
18 New Member
try this:

1. ^[-]?([1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|\\.[0-9]{1,2})$ for numbers with decimals.

2. ^[1-9]{1}$|^[1-4]{1}[0-9]{1}$|^1000000$ for integers between 1 and 1000000.

Is this what you were looking for?
yes but if user press any spacebar in the textbox it should give an error message.
Mar 24 '07 #5
archvivek
5 New Member
hello

First keep a regular expression validator next ur require textbox.
Right click and get into the properties.
set the according properties...
Control to validate property-(required textbox name)
Display property-Dynamic
Error message- required message
Validate expression property- ^[0-9]*|\d*\d{1}?\d*

It should work now...

Like this there are various expresssions for each and every validations.
Mar 25 '07 #6

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

Similar topics

1
1898
by: julio | last post by:
I noticed that pressing spacebar when a listbox has the focus scrolls the listbox to the first selected item. I'm intercepting the spacebar press event at form level for stopping and starting audio playback, so I would like to remove the default behaviour form the listbox, and also from other buttons and controls. I tryed ( following a tutorial ) to subclass the listbox class, but I was able to intercept only mouseclicks, not the...
16
2558
by: MLH | last post by:
In Access 97 and Access 2.0 applications, if a command button has the focus, the spacebar will 'PRESS" the key. How does one go about disabling this annoying BEATURE?
0
3017
by: Andy Eshtry | last post by:
I have a radio button list, a textbox representing SIN or EIN based on my radio button list selection so I put 2 regularexpressionvalidator to evaluate the value of textbox. EIN must be (for simplicity) with this format (2 digits) like 12 (ValidationExpression="\d{3}-\d{2}") and SIN must be (for simplicity) with this format (3digits-2digits) like 123-45 (ValidationExpression="\d{3}-\d{2}") It works well. The problem is: When I...
1
1563
by: rockdale | last post by:
Hi, all Is there a way to dynamically attach a regularexpressionvalidator to a textbox base on dropdownlist selected item? Let's say I have a dropdownlist list all contact type - phone, cell, email ...etc and a textbox that allow user to type in their contact info. When they choose email, I want attach the regularexpressionvalidator of email to the textbox, when the ddl selected phone, then I want attach phone regExp to the same...
4
6057
by: =?Utf-8?B?Y3VyaW91cw==?= | last post by:
I am using a RegularExpressionValidator to validate a TextBox. I use "^?+(\.*)?$" to check for a real number. The control works fine as long as the user enters something in the TextBox; it does not work if the user leaves the TextBox blank. Is there a bug in the implementation of the RegularExpressionValidator? The above regluar expression should also catch no entry by the user. I have added a RequiredFieldValidator to solve the...
9
3931
by: Nathan Sokalski | last post by:
I have several TextBoxes with TextMode="MultiLine" in which I want to limit the number of characters that can be entered using a RegularExpressionValidator. I have come up with the following ValidationExpression: {0,250} The only problem with this ValidationExpression is that it does not include the \n character as stated on the following documentation page:
0
9680
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10456
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10012
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6788
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5442
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4118
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2926
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.