// Ensure text box is kept bellow the maximum value of an overrun decimal maxOverrun = 15; if (Decimal.Parse(tbOverrun.Text) > maxOverrun) { tbOverrun.Text = "15"; }
Validating
decimal maxOverrun = 15; decimal userValue; decimal.TryParse(tbOverrun.Text, out userValue); if (userValue > maxOverrun) { //Do stuff here }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)