Solved

Numeric Conditions

Posted on 2012-03-24
2
296 Views
Last Modified: 2012-03-24
How to implement a Condition like my Code below?

private bool Validate()
{
if (txtCost.Text.Trim() is not numeric?????)
{
 MessageBox.Show("field must be numeric");
}
{
0
Comment
Question by:Whing Dela Cruz
2 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 37760860
Try this:

private bool Validate()
{
    double d;

    if (!double.TryParse(txtCost.Text, out d))
    {
        MessageBox.Show("field must be numeric");
    }
}

Open in new window

0
 

Author Closing Comment

by:Whing Dela Cruz
ID: 37760956
Perfect! Thanks a lot...
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question