473,545 Members | 529 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IsNumeric() Problem

I have a problem with VB.Net and IsNumeric() function because it always
returns FALSE even the string can be a number.
There is another strange thing, the same program (it is a test) runs good on
one and doesn't run an another one.

The program test is very simple, just a form with a text box and a button.
The text box has a validation rule that check if the insert string is a
numeric value, that's all.
MsgBox( IsNumeric(TextB ox1.Text)) ----<<<< always write FALSE even if the
contenet of TextBox1 is "111"

Thanks in advice, Michele
Nov 21 '05 #1
10 2773
Hi Michele,

I have tested it exactly as you specify, and it returns true when '111' and
false when '1a11'. I don't know what to suggest, other than a reinstall of
the .net framework and vs .net.

Bernie Yaeger

"michele" <mi*****@zenna. it> wrote in message
news:ut******** ******@TK2MSFTN GP12.phx.gbl...
I have a problem with VB.Net and IsNumeric() function because it always
returns FALSE even the string can be a number.
There is another strange thing, the same program (it is a test) runs good
on one and doesn't run an another one.

The program test is very simple, just a form with a text box and a button.
The text box has a validation rule that check if the insert string is a
numeric value, that's all.
MsgBox( IsNumeric(TextB ox1.Text)) ----<<<< always write FALSE even if
the contenet of TextBox1 is "111"

Thanks in advice, Michele

Nov 21 '05 #2
Michele,

I agree with Bernie, I have no problem running that code. You might try
doing a cast of the textbox info. You might try to cast the variable to see
if you get an error from that:

dblVar = CDbl(txtInput.T ext)

Curtis

"Bernie Yaeger" <be*****@optonl ine.net> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
Hi Michele,

I have tested it exactly as you specify, and it returns true when '111'
and false when '1a11'. I don't know what to suggest, other than a
reinstall of the .net framework and vs .net.

Bernie Yaeger

"michele" <mi*****@zenna. it> wrote in message
news:ut******** ******@TK2MSFTN GP12.phx.gbl...
I have a problem with VB.Net and IsNumeric() function because it always
returns FALSE even the string can be a number.
There is another strange thing, the same program (it is a test) runs good
on one and doesn't run an another one.

The program test is very simple, just a form with a text box and a
button. The text box has a validation rule that check if the insert
string is a numeric value, that's all.
MsgBox( IsNumeric(TextB ox1.Text)) ----<<<< always write FALSE even if
the contenet of TextBox1 is "111"

Thanks in advice, Michele


Nov 21 '05 #3
Try MsgBox(IsNumeri c(Trim$(TextBox 1.Text))).

Because Windows Forms used proportional fonts, you might have spaces at the
beginning of the text box value. Leading spaces can cause IsNumeric to
misread a value. Also, make sure you have "111" vs. "lll" (lower case LLL).

Mike Ober.

"Curtis" <cs*****@hotmai l.com> wrote in message
news:OF******** *****@tk2msftng p13.phx.gbl...
Michele,

I agree with Bernie, I have no problem running that code. You might try
doing a cast of the textbox info. You might try to cast the variable to see if you get an error from that:

dblVar = CDbl(txtInput.T ext)

Curtis

"Bernie Yaeger" <be*****@optonl ine.net> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
Hi Michele,

I have tested it exactly as you specify, and it returns true when '111'
and false when '1a11'. I don't know what to suggest, other than a
reinstall of the .net framework and vs .net.

Bernie Yaeger

"michele" <mi*****@zenna. it> wrote in message
news:ut******** ******@TK2MSFTN GP12.phx.gbl...
I have a problem with VB.Net and IsNumeric() function because it always
returns FALSE even the string can be a number.
There is another strange thing, the same program (it is a test) runs good on one and doesn't run an another one.

The program test is very simple, just a form with a text box and a
button. The text box has a validation rule that check if the insert
string is a numeric value, that's all.
MsgBox( IsNumeric(TextB ox1.Text)) ----<<<< always write FALSE even if
the contenet of TextBox1 is "111"

Thanks in advice, Michele




Nov 21 '05 #4
I developed a little program that works and then an another user asked me if
I can install the same program on his computer. Either computer has Windows
XP Pro and I installed the framework.
I develop a little program just for test the IsNumeric() function: a form, a
textbox and button.
I can't understand why the framework doen't work.
There are tool to check the framework?
"Michael D. Ober" <obermd.@.alum. mit.edu.nospam> ha scritto nel messaggio
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Try MsgBox(IsNumeri c(Trim$(TextBox 1.Text))).

Because Windows Forms used proportional fonts, you might have spaces at
the
beginning of the text box value. Leading spaces can cause IsNumeric to
misread a value. Also, make sure you have "111" vs. "lll" (lower case
LLL).

Mike Ober.

"Curtis" <cs*****@hotmai l.com> wrote in message
news:OF******** *****@tk2msftng p13.phx.gbl...
Michele,

I agree with Bernie, I have no problem running that code. You might try
doing a cast of the textbox info. You might try to cast the variable to

see
if you get an error from that:

dblVar = CDbl(txtInput.T ext)

Curtis

"Bernie Yaeger" <be*****@optonl ine.net> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
> Hi Michele,
>
> I have tested it exactly as you specify, and it returns true when '111'
> and false when '1a11'. I don't know what to suggest, other than a
> reinstall of the .net framework and vs .net.
>
> Bernie Yaeger
>
> "michele" <mi*****@zenna. it> wrote in message
> news:ut******** ******@TK2MSFTN GP12.phx.gbl...
>>I have a problem with VB.Net and IsNumeric() function because it always
>>returns FALSE even the string can be a number.
>> There is another strange thing, the same program (it is a test) runs good >> on one and doesn't run an another one.
>>
>> The program test is very simple, just a form with a text box and a
>> button. The text box has a validation rule that check if the insert
>> string is a numeric value, that's all.
>>
>>
>> MsgBox( IsNumeric(TextB ox1.Text)) ----<<<< always write FALSE even
>> if
>> the contenet of TextBox1 is "111"
>>
>> Thanks in advice, Michele
>>
>
>



Nov 21 '05 #5
"michele" <mi*****@zenna. it> schrieb:
I developed a little program that works and then an another user asked me
if I can install the same program on his computer. Either computer has
Windows XP Pro and I installed the framework.
I develop a little program just for test the IsNumeric() function: a form,
a textbox and button.
I can't understand why the framework doen't work.
There are tool to check the framework?


Which language does the operating system have? Which version of the .NET
Framework is installed? You can use the batch file provided by Frank
Dzaebel (<URL:http://www.dzaebel.net/NetVersions.htm >) to determine the
installed versions of the .NET Framework.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #6
Michele,

Can you test it like this.

\\\
TextBox1.Text = "111"
MsgBox(IsNumeri c(TextBox1.Text ))
///
I hope this helps,

Cor
Nov 21 '05 #7
I did it in my trouble shooting but the problem is in the machine where is
installed Visual Studio works well and also in other pc but when I try to
run it on that pc It returns FALSE so I think there is some problem with the
framework but I don't know which ones.
Thanks

"Cor Ligthert [MVP]" <no************ @planet.nl> ha scritto nel messaggio
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
Michele,

Can you test it like this.

\\\
TextBox1.Text = "111"
MsgBox(IsNumeri c(TextBox1.Text ))
///
I hope this helps,

Cor

Nov 21 '05 #8
ru
On Wed, 21 Sep 2005 16:55:10 +0200, "michele" <mi*****@zenna. it>
wrote:
I have a problem with VB.Net and IsNumeric() function because it always
returns FALSE even the string can be a number.
There is another strange thing, the same program (it is a test) runs good on
one and doesn't run an another one.

The program test is very simple, just a form with a text box and a button.
The text box has a validation rule that check if the insert string is a
numeric value, that's all.
MsgBox( IsNumeric(TextB ox1.Text)) ----<<<< always write FALSE even if the
contenet of TextBox1 is "111"

Thanks in advice, Michele


I had the same thing a couple of months ago, and it turned out to be a
Regional Settings thing: a decimal separator and a thousands separator
set to the same symbol. Fiddle around with it to see when and what
causes the error.

I changed the IsNumeric() logic to the following routine, and that
helped:

Private Sub txtScore_KeyPre ss(ByVal sender As Object, ByVal e As
System.Windows. Forms.KeyPressE ventArgs) Handles txtScore.KeyPre ss
If e.KeyChar < "0" Or e.KeyChar > "9" Then
If (e.KeyChar = Chr(&H8)) Or (e.KeyChar = "Keys.Delet e")
Then
Else
e.Handled = True
End If
End If
End Sub

Here's the related thread:
http://groups.google.com/group/micro...1507af00c0d2b4

ru
Nov 21 '05 #9
I changed the regional setting and then the function IsNumeric() has started
but I can't adopt this kind of solution because another program doesn' t
work if the decimal separator is different from comma character. I think the
solution is if I can change character separator on run-time

"ru" <ur@sx3all.be > ha scritto nel messaggio
news:fs******** *************** *********@4ax.c om...
On Wed, 21 Sep 2005 16:55:10 +0200, "michele" <mi*****@zenna. it>
wrote:
I have a problem with VB.Net and IsNumeric() function because it always
returns FALSE even the string can be a number.
There is another strange thing, the same program (it is a test) runs good onone and doesn't run an another one.

The program test is very simple, just a form with a text box and a button.The text box has a validation rule that check if the insert string is a
numeric value, that's all.
MsgBox( IsNumeric(TextB ox1.Text)) ----<<<< always write FALSE even if thecontenet of TextBox1 is "111"

Thanks in advice, Michele
I had the same thing a couple of months ago, and it turned out to be a
Regional Settings thing: a decimal separator and a thousands separator
set to the same symbol. Fiddle around with it to see when and what
causes the error.

I changed the IsNumeric() logic to the following routine, and that
helped:

Private Sub txtScore_KeyPre ss(ByVal sender As Object, ByVal e As
System.Windows. Forms.KeyPressE ventArgs) Handles txtScore.KeyPre ss
If e.KeyChar < "0" Or e.KeyChar > "9" Then
If (e.KeyChar = Chr(&H8)) Or (e.KeyChar = "Keys.Delet e")
Then
Else
e.Handled = True
End If
End If
End Sub

Here's the related thread:

http://groups.google.com/group/micro...1507af00c0d2b4
ru

Nov 21 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2306
by: eje | last post by:
IsNumeric(value) should return false if value "can not be successfully converted to a Double." Instead I get the following error message: "Input string was not in a correct format." I use the following function in a validating class to use when needed. (Value = H880118A gave the error (like other 'unconvertible' strings)) Public...
4
13264
by: Eugene Anthony | last post by:
I have received the following feedback for the two functions bellow: "The ISNUMERIC test is WORTHLESS for checking for an INT value, because ISNUMERIC will happily accept DOUBLE values, such as 89.11998811777 and other values that are simply *NOT* INT values." <% function isZip(input)
14
40108
by: Kenny | last post by:
Hello, I would like to know if the function IsNumeric requires a header like #include <iostream> to be functionnal thanks ken
8
2602
by: John Bowman | last post by:
Hello, Does anyone have a good/reliable approach to implementing an IsNumeric() method that accepts a string that may represent a numerical value (eg. such as some text retrieved from an XML file)? Thus if you pass it "1" or "5.12345" it returns true, but "1b3q" it returns false? I know VB has this sort of function, but was wondering how to...
3
1960
by: Radith Silva | last post by:
Dear All; Thanx for helpt with previous question. Still learning?? FROM A VB 6.0 BOOK: any way; I have used IsNumeric function and check all namespace conflicts and all and nothing seems to solve the error.
7
2364
by: Nathan Truhan | last post by:
All, I think I may have uncovered a bug in the IsNumeric function, or at least a misunderstanding on functionality. I am writing a Schedule Of Classes Application for our campus and have a section that lists the Times, Buildings and rooms for courses. In this section I have a function called PadCell that takes3 parameters, one the value,...
8
2575
by: moondaddy | last post by:
What's the .net framework equivalent of the vb function isnumeric? If there isn't one, how can I test a string variable to see if its a number or not? I don't want to use isnumeric if possible -- moondaddy@noemail.noemail
12
3042
by: sck10 | last post by:
Hello, I am trying to determine if a value is NOT numeric in C#. How do you test for "Not IsNumeric"? protected void fvFunding_ItemInserting_Validate(object sender, FormViewInsertEventArgs e) if (e.NewValues != "" && Not IsNumeric(e.NewValues)) {
17
2263
by: MLH | last post by:
I have tested the following in immed window: ?isnumeric(1) True ?isnumeric(1.) True ?isnumeric(1.2) True ?isnumeric(1.2.2)
0
7465
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...
0
7398
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...
0
7656
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. ...
0
7805
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
5969
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...
1
5325
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4944
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...
1
1878
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
1013
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.