IsNumeric()问题 [英] IsNumeric() Problem

查看:93
本文介绍了IsNumeric()问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有VB.Net和IsNumeric()函数的问题因为它总是

返回FALSE,即使字符串可以是数字。

还有一件奇怪的事情,相同的程序(这是一个测试)运行良好的

一个并没有运行另一个。


程序测试非常简单,只是一个带有文本框和按钮的表单。

文本框有一个验证规则,检查插入字符串是否为

数值,即'所有。

MsgBox(IsNumeric(TextBox1.Text))----<<<<即使TextBox1的

背景为111,也总是写错FALSE


感谢您的建议,Michele

解决方案

嗨Michele,


我已经按照你指定的方式对它进行了测试,当''111'和
$时它返回true 1a11时b $ b为假。我不知道该建议什么,除了重新安装

.net框架和vs .net。


Bernie Yaeger


" michele" < MI ***** @ zenna.it>在留言中写道

news:ut ************** @ TK2MSFTNGP12.phx.gbl ...

我遇到了问题VB.Net和IsNumeric()函数因为它总是返回FALSE,即使字符串也可以是数字。
还有一个奇怪的事情,同一个程序(它是一个测试)运行良好
在一个,并没有运行另一个。

程序测试非常简单,只是一个带有文本框和按钮的表单。
文本框有一个验证规则,检查插入字符串是否为
数值,即全部。

MsgBox(IsNumeric(TextBox1.Text))----<<<<即使TextBox1的上下文是111,也总是写错了

感谢您的建议,Michele



Michele,


我同意Bernie,运行该代码没有问题。您可以尝试

进行文本框信息的转换。如果你收到错误,你可能会尝试转换变量以查看




dblVar = CDbl(txtInput.Text)


柯蒂斯


" Bernie Yaeger" <是***** @ optonline.net>在消息中写道

新闻:%2 **************** @ TK2MSFTNGP14.phx.gbl ...

Hi Michele ,

我已经按照你指定的方式对它进行了测试,当''111''时它返回true,而当''1a11'时它返回false。我不知道该建议什么,除了重新安装.net框架和vs .net。

Bernie Yaeger

michele < MI ***** @ zenna.it>在消息中写道
新闻:ut ************** @ TK2MSFTNGP12.phx.gbl ...

我遇到了VB.Net和IsNumeric()函数因为它总是
返回FALSE,即使字符串可以是一个数字。
还有一个奇怪的事情,同一个程序(它是一个测试)在一个上运行良好
并且没有运行另一个。

程序测试非常简单,只是一个带有文本框和
按钮的表单。文本框有一个验证规则,用于检查插入
字符串是否为数字值,即全部。

MsgBox(IsNumeric(TextBox1.Text))----< ;<<<即使
TextBox1的上下文是111,也总是写错了

感谢您的建议,Michele




尝试MsgBox(IsNumeric(Trim


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(TextBox1.Text)) ----<<<< always write FALSE even if the
contenet of TextBox1 is "111"

Thanks in advice, Michele

解决方案

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**************@TK2MSFTNGP12.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(TextBox1.Text)) ----<<<< always write FALSE even if
the contenet of TextBox1 is "111"

Thanks in advice, Michele



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.Text)

Curtis

"Bernie Yaeger" <be*****@optonline.net> wrote in message
news:%2****************@TK2MSFTNGP14.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**************@TK2MSFTNGP12.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(TextBox1.Text)) ----<<<< always write FALSE even if
the contenet of TextBox1 is "111"

Thanks in advice, Michele




Try MsgBox(IsNumeric(Trim


这篇关于IsNumeric()问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆