473,394 Members | 1,951 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.

Is there a C# Function that is similar to the VB IsNumeric function

Visual Basic has a function IsNumeric.
It returns True if the argument is a number, false if not.

in VB code it would look like this:

Expand|Select|Wrap|Line Numbers
  1. Dim txt as string = me.Textbox1.Text
  2. if IsNumeric(txt)
  3.     MsgBox("Its a number.");
  4. else 
  5.     MsgBox("Its not a number.");
  6. end if
  7.  
What I'm looking for is a similar function in C#

Thanks,
Bill
May 19 '10 #1

✓ answered by GaryTexmo

http://www.lmgtfy.com/?q=C%23+IsNumeric

;)

A TryParse on the type you want it to go to may also work.

3 1254
GaryTexmo
1,501 Expert 1GB
http://www.lmgtfy.com/?q=C%23+IsNumeric

;)

A TryParse on the type you want it to go to may also work.
May 19 '10 #2
Thanks That works .
May 19 '10 #3
Plater
7,872 Expert 4TB
I would say for a generic "numeric", use Double.TryParse(), It takes +/- values of integer or float types.
May 20 '10 #4

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

Similar topics

16
by: WittyGuy | last post by:
Hi, What is the major difference between function overloading and function templates? Thanks! http://www.gotw.ca/resources/clcm.htm for info about ]
1
by: John | last post by:
// Between these two ways of creating a JS function, do they represent the exact same thing?: function myFn(a) {return 1;} // SAMPLE A myFn = function(a) {return 1;} // SAMPLE B // ... and...
39
by: Randell D. | last post by:
Folks, I'm sure this can be done legally, and not thru tricks of the trade - I hope someone can help. I'm writing a 'tool' (a function) which can be used generically in any of my projects. ...
6
by: _andrea.l | last post by:
I'd like to write a function like: function f(){ ... bla ...} f_example(f); function f_example($function_to_execute) {...bla... $function_to_execute() ...bla....} AND how to pass the...
2
by: Edlueze | last post by:
Greetings: I have two functions and I would like to pass the ParamArray gathered from one function to the other function. For the purposes of this post, let's say that they are calculating...
27
by: Marlene Stebbins | last post by:
I am experimenting with function pointers. Unfortunately, my C book has nothing on function pointers as function parameters. I want to pass a pointer to ff() to f() with the result that f() prints...
4
by: Brett | last post by:
I'm trying to use the F1 function inside of F2 function below. I keep getting the error posted below the code. If I remove the Shared declaration from F2, it works fine. What exactly does the...
2
by: James | last post by:
Simple question... If you execute a block of statements that uses the IsNumeric function on a text box that contains no data, will it cause a run time error? Thanks looks like this: If...
4
by: mantrid | last post by:
Can anyone see why the checkbox in the code below doesnt get ticked when the textbox is changed ***This javascript function is called in the textbox's onchange event to check it when it is...
29
by: Ravishankar S | last post by:
Dear C Experts, While prepating a content for a C course,I made section on function prototypes. Could you kindly provide me your comments on its correctness. Thank you ! Q12: What is the...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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.