S
Stephan Bour
IS there a C# equivalent to the VB IsNumeric function?
Stephan said:IS there a C# equivalent to the VB IsNumeric function?
using System;
using System.Text;
using System.Text.RegularExpressions;
private bool IsTextValidated(string strTextEntry)
{
Regex objNotWholePattern = new Regex("[^0-9]");
return !objNotWholePattern.IsMatch(strTextEntry);
}
using System;
using System.Text;
using System.Text.RegularExpressions;
private bool IsTextValidated(string strTextEntry)
{
Regex objNotWholePattern = new Regex("[^0-9]");
return !objNotWholePattern.IsMatch(strTextEntry)
[COLOR="Blue"]&& (strTextEntry != ""); [/COLOR]
}
private void button1_Click(object sender, EventArgs e) {
string s = "1";
if (Information.IsNumeric(s)) {
MessageBox.Show("yes it's a number");
}
}
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.