The Easiest Way To Check Weather The Input String Is Numeric or Not Is By Converting It To A Double Variable.For This We can Use double.TryParse method.This Method Returns A Boolean Value According To the Conversion.
You Can Use Following Code Unit Check the User Input
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MyProject
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnCheck_Click(object sender, EventArgs e)
{
double dNum1;//To Save The Inputs
bool chk = double.TryParse(txtEnterText.Text, out dNum1);
if (chk)
{
lblOutPut.Text = "Its A Numeric String";
}
else
{
lblOutPut.Text = "Its Not A Numeric String";
}
}
}
}
