Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
Target(Rs)  Commission
1000-100000      2%
101000-150000   3%
151000-200000   4%
>201000     6%



[textbox][button]
Accept the sales value in a text box and display the commission as per the above table??
any one can help me..i searched in google.bt m nt getting?


[100000(entering amt in txt box)][show button]
[2000(showing value in text box aftr clickin show button)]
Posted
Updated 2-Dec-11 21:53pm
v2
Comments
OriginalGriff 3-Dec-11 3:48am    
We need more information - where are you trying to do this? In a database? In C#, VB, Javascript?
Why is working out 2% of a value difficult?
Sorry, but I can't see where you are having a problem, so I can't answer!
Use the "Improve question" widget to edit your question and provide better information.

1 solution

This smells heavily of homework, so I won't give you the code!
However, it isn't difficult at all:

1) Handle the button Click event.
2) Convert the text box value to an integer, using the int.Parse[^] or int.TryParse[^] method - remember to report problems to the user! (I would use TryParse, so that I detect the error rather than getting an exception).
3) Compare the value with your bottom range: if it is greater than or equal to 1000, and less than or equal to 100000, then take 2% of the value.
4) If it isn't in the range above, try the next. Repeat for all ranges.
5) If you still haven't found it, report an error.


All you need to do is an IF statement with a TryParse, followed by an IF ... THEN... ELSE IF ... THEN ... ELSE ... construct.

Try it - it really isn't difficult!
 
Share this answer
 
Comments
member60 3-Dec-11 4:22am    
My 5!
thatraja 3-Dec-11 14:43pm    
5!

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