Click here to Skip to main content
15,908,264 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have two text box the number write in text box one can't less than from the number that write in text box 2
Posted
Comments
BillWoodruff 13-Jan-16 4:07am    
You need to provide more information. Is this Windows Forms ?

What action by the user triggers your evaluation of the content of the two Text Boxes ?

ASP.NET
Small number:<br />
<asp:TextBox runat="server" id="txtSmallNumber" /><br /><br />
Big number:<br />
<asp:TextBox runat="server" id="txtBigNumber" /><br />
<asp:CompareValidator runat="server" id="cmpNumbers" controltovalidate="txtSmallNumber" controltocompare="txtBigNumber" operator="LessThan" type="Integer" errormessage="The first number should be smaller than the second number!" /><br />
 
Share this answer
 
Comments
Sascha Lefèvre 13-Jan-16 4:11am    
What if the inquirer is talking about Windows Forms or WPF? What if, in your solution, someone enters text instead of numbers?
Change the TextBoxes to NumericUpDowns. They guarantee to have a number available in the Value property.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900