29 January 2015

Int value validation in c#.net

            int parsedValue;
            if (int.TryParse(txt_number.Text, out parsedValue))
            {

                //valid Number
                // Do something with value
            }
            else
            {
                //invalid Number
                lbl_error.Text = "Please enter a valid number";
                return;
            }

No comments:

Post a Comment