Solved

Numeric Conditions

Posted on 2012-03-24
2
294 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 74

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
Comment Utility
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
Comment Utility
Perfect! Thanks a lot...
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now