i posted this question already but there is some mistake in the mistake so again post this question with correct one.
Basic textbox1 (1000) 12%on basic textbox2 120
in this textbox1 if amt 781 greater means 780 amt want to display in textbox2 else 12% on basic (1000) 120 amt want to display in textbox2.
for that how to write code using csharp
please help me
Niravkumar VaghelaPosted Jul 25, 2012, 5:37 AM
You can try this:
TextBox2.Text = Convert.ToInt32(TextBox1.Text) > 780 ? "780" : (Convert.ToInt32(TextBox1.Text) * 0.12).ToString();
Hope this will help you.
Santhosh Kumar JayaramanPosted Jul 25, 2012, 4:37 AM
Whatever amount i enter in textbox1, i should check whether it is greater than 781.If it's greater than 781, then i should populate textbox 2 with 780. If the amount is less than 780, then i have to calculate 12% of textbox1 value and populated it in textbox2? Right??
if (Convert.ToInt32(textbox1.Text)>781)
textBox2.Text=(780).ToString();
else
textBox2.Text= ((Convert.ToInt32(textbox1.Text))*0.12).ToString();