Guy's,
I'm trying to insert a value into a textbox if the value in my sumTextbox is above £250.
Example I have a two textboxes one just called textbox1 and one called sumtextbox, when I run a function (button click) I would like to check the value in sumtextbox and if it's above £250 it inserts a value in textbox1 of "YES"
Is that possible with a button click?
Loading
VulpesPosted Mar 21, 2014, 5:43 AM
decimal d;
decimal.TryParse(sumtextbox.Text, out d);
if (d > 250m) textbox1.Text = "YES";
VulpesPosted Mar 21, 2014, 6:25 AM
In this example, if the sumtextbox had been empty or contained something other than a number, then there would be no exception and 'd' would harmlessly be set to zero.
As this is under 250, the code would do nothing :)
mike DelvottiPosted Mar 21, 2014, 6:03 AM
I never would imagine it would only take 3 lines of code :-)