473,503 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
3 1345
There is no dead-on corresponind keyword, you'll need to write your own.
Check out:
http://weblogs.asp.net/acampbell/arc...29/100948.aspx
(make sure the read the comments!)

and
http://weblogs.asp.net/ssivakumar/ar.../17/27930.aspx

Karl

--
http://www.openmymind.net/

"Vikas Kumar" <ef*****@newsgroups.nospam> wrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
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
No, the code gets all items that are numeric. If you use that to get
values from checkboxes, the code is very sensetive to changes.

The IsNumeric method is something that is left over from VB 6. There is
no corresponding method in C#. You can reference
Microsoft.VisualBasic.dll and use the IsNumeric method, but you should
really use an alternative method to identify the checkboxes.

Can't the checkboxes be identified using their name, or part of the name?

To verify that a string contains only digits, you can use a regular
expression:

If Regex.IsMatch(item, "^\d+$") Then

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 #3
There is no exact equivalent to the IsNumeric keyword. It's a feature of
VB.NET, and C# simply doesn't have it.
I suggest you use "TryParse" instead of IsNumeric; it is somewhat similar.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Vikas Kumar" <ef*****@newsgroups.nospam> wrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
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

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

Similar topics

8
2291
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
13260
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
40102
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
2598
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
2359
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...
7
1890
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
2572
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
3040
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
2258
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
7201
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
7083
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
7278
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,...
0
7328
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...
1
6988
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
7456
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...
0
3166
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...
0
1510
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 ...
1
734
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.