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";
}
}
}
}
Subscribe to:
Post Comments (Atom)
JWT Token Decode Using Jquery
When it come to authentication we use many mechanism. Ones the user authenticated we must keep these details somewhere safe. So we can share...
-
In this blog post Ill explain you the logic behind the Sri Lankan National Identity Card (NIC). Sri Lanka now has Old NIC No Format as well ...
-
In This Article I Will Demonstrate You To Create A Simple Chat Program Using Java Remote Method Invocation(RMI). Following Program Supports ...
-
In a windows form application sometimes you may want to import a excel file to a data grid view. In this blog post Ill demonstrate to you gu...
No comments:
Post a Comment