473,609 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Releated DesktopBased for validation code

1 New Member
I have given a text box where when i press number key it should validate for number should accept only for Char digit,
so what will validation code ?
May 6 '14 #1
1 1206
chaarmann
785 Recognized Expert Contributor
Just get the key pressed as char and test that it lies between >='0' and <='9'.
That is the validation code for a positive 1-digit natural number.
What else do you want to test for?
  • numbers with more than one digit
  • leading zeros
  • minus sign
  • floating point numbers
  • exponent indicator
  • complex numbers
May 7 '14 #2

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

Similar topics

1
6943
by: Paul Aspinall | last post by:
Hi I want to put all my validation code in one place, for my FormView control, regardless of whether its editing or inserting data. Is there a 'Validation' event somewhere?? or do I point the ItemUpdating and ItemInserting events to the same place, and put my validation code there? Thanks
4
2186
by: ss | last post by:
hi, can anybody gives me a sample code where the sql injection attack is validated. how can i do that in business logic layer and pass the error to the presentation tier I want the sample code
1
1591
by: holy moly | last post by:
Hello, the user enters details into a form (values.php) whose action is (insert_values.php), where does the server-side validation code go? (I know other posts on this subject say use PHP_SELF for the action but I don't want to redo all the code) Where should I put the code? I tried it myself but neither way worked so probably the code is wrong for this but I know it works using the PHP_SELF method... if (isset($_POST)) {
2
1609
by: karen987 | last post by:
Can someone please tell me how to alter this code if it needs altering, . thanks in advance. 1. The form keeps focusing on "username" and won't submit. The 2 username functions may be clashing? i want the username to be letters and numbers only , no special characters or spaces, 5-18 characters. 2. The country is a drop down list, and they must select one. I think since it is a drop down i don't need the function which checks for blanks...
3
1660
by: localhost1 | last post by:
i have a serious probem in javascript form validation. i have written a validation code in javascript. it working in internet explorer 7 but the same code is not working in mozilla firefox. what could be the reason??
1
1529
by: ambi21hs | last post by:
Hi i need a validation code in c for month in the mon-yyyy format 2 embed in between sql so any one help me out with this.. thank you
3
2272
by: ambi21hs | last post by:
i need a validation code in c for employee number, only number should be allowed can any one help me out with dis..
2
1314
by: matt | last post by:
this is my first program in this language ever (besides 'hello world'), can i get a code critique, please? it's purpose is to read through an input file character by character and tally the occurrence of each input character. it seems to compile and run, so i'm looking for the opinions of old-timers here plz. /* * File: occurrenceTally.cpp * Author: matthew *
3
5551
by: PrabodhanP | last post by:
I hv following javascript form validation code works in IE but not in Mozilla-Firefox ...please suggest <script type="text/javascript"> function IsNumeric(strString) // check for valid numeric strings { var strValidChars = "0123456789.-"; var strChar; var blnResult = true;
0
1275
xarzu
by: xarzu | last post by:
While debugging in C# / Silverlight, how does one output validation code to the output window?
0
8138
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
8090
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8578
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
8408
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
5523
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
4030
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...
0
4094
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2538
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
1
1683
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.