souptoy's Profile User Rating: -----

Reputation: 54 Whiz
Group:
Active Members
Active Posts:
244 (0.09 per day)
Joined:
17-January 08
Profile Views:
14,257
Last Active:
User is offline Apr 20 2015 10:59 AM
Currently:
Offline

Previous Fields

Country:
Who Cares
OS Preference:
Who Cares
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
0
Icon   souptoy has not set their status

Posts I've Made

  1. In Topic: textbox.text validation

    Posted 26 Sep 2013

    You could also do the following:

    decimal AppID = 0;
    decimal.TryParse(txtAppId.Text, out AppID);
    
    


    TryParse will attempt to convert your string into the decimal base type and set it to the out variable. If it cannot, the out variable will be 0. This, in turn does not throw an exception.

    Optionally, you can do the following:

    decimal AppID = 0;
    bool blnIsConverted = false;
    blnIsConverted = decimal.TryParse(txtAppId.Text, out AppID);
    
    if (!blnIsConverted){
        //handle missing value
    }
    
    


    As far as I know, Convert.ToDecimal really does Decimal.Parse so if you have an issue converting the string, an Exception will be thrown.

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Location:
CA

Contact Information

E-mail:
Private
Website URL:
Website URL  http://