473,387 Members | 1,798 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,387 software developers and data experts.

positive no

18
I have a textbox in asp.net . and i want to enter only positive number in that text box.I have already used rangevalidator but it takes on -0 without error.please solve the porblem.
Mar 16 '07 #1
7 831
shweta123
692 Expert 512MB
Hi,

What values have you given for Maximum value and Minimum Value of Range
Validator?

Try for this, Maximum Value=9 and MinimumValue=0
Mar 16 '07 #2
prp
18
Hi,

What values have you given for Maximum value and Minimum Value of Range
Validator?

Try for this, Maximum Value=9 and MinimumValue=0
I gave Minimun Value=0
Maximum Value=9
Type =Integer

But TextBox accept -0 without any error
Mar 16 '07 #3
radcaesar
759 Expert 512MB
Refer this buddy,

http://www.java2s.com/Code/VB/GUI/NumberonlyTextBox.htm

:)
Mar 16 '07 #4
prp
18
Refer this buddy,

http://www.java2s.com/Code/VB/GUI/NumberonlyTextBox.htm

:)
I need the code in asp.net
Mar 16 '07 #5
SammyB
807 Expert 512MB
I have a textbox in asp.net . and i want to enter only positive number in that text box.I have already used rangevalidator but it takes on -0 without error.please solve the porblem.
But, -0 = 0 and you have set the min =0. If you don't want zero, then set the min = 1. -0 is not negative and it is not positive, it is zero.
Mar 16 '07 #6
AricC
1,892 Expert 1GB
I have a textbox in asp.net . and i want to enter only positive number in that text box.I have already used rangevalidator but it takes on -0 without error.please solve the porblem.
You could write a keypress event to only allow numbers in the textbox. You could even do it with Javascript if you don't want to do it server side.
Mar 17 '07 #7
Here's how we can accomplish this easily

Expand|Select|Wrap|Line Numbers
  1. Imports System.Text.RegularExpressions
  2.  
  3. Public Class BlahBlahBlah
  4.  
  5.         Private Sub NoNegativeZero()
     
  6.         Dim MyRE As New Regex("^[0-9]+$")
  7.         Dim MyMatch As Match = MyRE.Match(TextBox1.Text)
  8.         If MyMatch.Success = False Then
  9.             MsgBox("I'm not cool with -0")
  10.         End If
  11.         End Sub
  12.  
  13. End Class
  14.  
Hope this helps.
# Anthony Towry
Mar 17 '07 #8

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

Similar topics

7
by: NotGiven | last post by:
I need to check the $_GET to make certain it is a positive integer. is_integer($_GET) is not working. I think it thinks it's a sting. So I tried casting it to an int using,...
7
by: pj | last post by:
Why does M$ Query Analyzer display all numbers as positive, no matter whether they are truly positive or negative ? I am having to cast each column to varchar to find out if there are any...
12
by: deko | last post by:
Is there an easy way to make all negative values positive in a particular table? I've been experimenting with this: Dim rst As DAO.Recordset Set rst = db.OpenRecordset("tblNegValues") Do...
3
by: Tripp Knightly | last post by:
I have a lookup table from which I want to categorize various bands of customer net income. Some of the income is positive, some is negative. The bands vary in size (ie, <500, -200 to 0, 100 to...
7
by: hasanainf | last post by:
Hi all, I have two querys QueryPurchased ProductID Location TotPcs Prod1 Loc1 100 Prod2 Loc1 50 Prod3 Loc1 150 Prod3 Loc3 150
19
by: Harshan | last post by:
The range of signed int is - 2^15 to + (2^15 )-1 (-32768 to 32767) Why the one less at positive Range ? (compared to the negative side..!) I came to know that it uses 2's compliment...
3
by: Ken Durden | last post by:
Is it possible to force positive values to have the + sign prefixed on them? double f1 = 1024.2; double f2 = -1024.2; string.Format( "{0:F}", f1 ); // +1024.2 string.Format( "{0:F}", f2 );...
4
by: bardo | last post by:
Does anyone know if there is a easy way to change a negitive int value into a positive int value. int a = -105 > change this to 105. With other words is there a command to change to neg...
19
by: Johs | last post by:
I need to make some special action if 'a' and 'b' are both positive or both negative. Is there some inbuilt function to check this? Johs
63
by: deepak | last post by:
Hi, Can someone give the standard function which can create positive integer value in C? Thanks, Deepak
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...

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.