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

isnumeric keyword

For Each item In Request.Form
If IsNumeric(item) Then
Try
Approved(item)
Catch ex As Exception
Response.Write(ex.Message)
End Try
End If
Next

this is code in vb.net to get all items whose check boxes are checked
i want to make same in c# what will be corressponding code
i am not getting IsNumeric in C#
what will be corresponding keyword against it
May 10 '06 #1
7 1884
There is no equivalent of IsNumeric in C# but see something very closely...
IsNumeric Function is in Microsoft.VisualBasic namespace. So you can
reference Microsoft.VisualBasic.Runtime assembly in your project and use all
Visual Basic Functions in C# ;) Cheers :)
"Vikas Kumar" wrote:
For Each item In Request.Form
If IsNumeric(item) Then
Try
Approved(item)
Catch ex As Exception
Response.Write(ex.Message)
End Try
End If
Next

this is code in vb.net to get all items whose check boxes are checked
i want to make same in c# what will be corressponding code
i am not getting IsNumeric in C#
what will be corresponding keyword against it

May 10 '06 #2
"Vikas Kumar" <ef*****@newsgroups.nospam> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
what will be corresponding keyword against it


1) Launch your Internet browser (IE, FireFox, Mozilla, Netscape etc)

2) Navigate to http://www.google.com

3) Enter the text below in the box:

"C#" IsNumeric

4) Hit the button
May 10 '06 #3
An example of coding your own IsNumeric in C# can be found here:
http://www.tangiblesoftwaresolutions...0IsNumeric.htm
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter & VB to C++ converter
Instant J#: VB to J# converter

"Vikas Kumar" wrote:
For Each item In Request.Form
If IsNumeric(item) Then
Try
Approved(item)
Catch ex As Exception
Response.Write(ex.Message)
End Try
End If
Next

this is code in vb.net to get all items whose check boxes are checked
i want to make same in c# what will be corressponding code
i am not getting IsNumeric in C#
what will be corresponding keyword against it

May 10 '06 #4
Actually, that's not true. IsNumeric is a managed function, and you can
access it on the Interaction class in the Microsoft.VisualBasic namespace in
Microsoft.VisualBasic.dll.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Altaf Al-Amin Najwani" <Al****************@discussions.microsoft.com> wrote
in message news:9F**********************************@microsof t.com...
There is no equivalent of IsNumeric in C# but see something very
closely...
IsNumeric Function is in Microsoft.VisualBasic namespace. So you can
reference Microsoft.VisualBasic.Runtime assembly in your project and use
all
Visual Basic Functions in C# ;) Cheers :)
"Vikas Kumar" wrote:
For Each item In Request.Form
If IsNumeric(item) Then
Try
Approved(item)
Catch ex As Exception
Response.Write(ex.Message)
End Try
End If
Next

this is code in vb.net to get all items whose check boxes are checked
i want to make same in c# what will be corressponding code
i am not getting IsNumeric in C#
what will be corresponding keyword against it

May 10 '06 #5
Hi Vikas,
Thank you for posting.

Besides above solutions, here's a kb article:

How to implement Visual Basic .NET IsNumeric functionality by using Visual
C# .NET or Visual C# 2005
http://support.microsoft.com/default...en-us%3B329488
Regards,

Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

May 11 '06 #6
A problem with that KB article is that passing null to the method causes an
exception while the VB IsNumeric handles the VB equivalent Nothing.
See the following link for a more accurate C# equivalent:
http://www.tangiblesoftwaresolutions...0IsNumeric.htm
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter & VB to C++ converter
Instant J#: VB to J# converter

"Walter Wang [MSFT]" wrote:
Hi Vikas,
Thank you for posting.

Besides above solutions, here's a kb article:

How to implement Visual Basic .NET IsNumeric functionality by using Visual
C# .NET or Visual C# 2005
http://support.microsoft.com/default...en-us%3B329488
Regards,

Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

May 12 '06 #7
Thanks David.

I agree with you on this. While the code in the kb produces correct result
regarding null value, it indeed incurs an unnecessary exception in
Double.TryParse() call.

Anyway, the easiest way is to simply use the version in
Microsoft.VisualBasic.dll.
Regards,

Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

May 12 '06 #8

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

Similar topics

8
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...
4
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...
14
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
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...
7
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...
3
by: Vikas Kumar | last post by:
For Each item In Request.Form If IsNumeric(item) Then Try Approved(item) Catch ex As Exception Response.Write(ex.Message) End Try End If Next
8
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 ...
12
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...
17
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
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:
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.