Click here to Skip to main content
15,901,122 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
I want to input various components of employee's salary (like HRA,Basic,etc.,) in separate textboxes, the want to calculate the derived components (like actual CTC,Gross,etc.,)through a button click. what is the appropriate way to code such a function?



Thanks to all(in advance).
Posted
Updated 11-Jan-16 18:48pm
v4
Comments
F-ES Sitecore 11-Jan-16 6:27am    
This is a very basic question, forums like this are not a good place to learn something from scratch. Go through some tutorials on vb.net (or better, a book) and how to do these things will become clear.
Dishi_Gupta 12-Jan-16 0:05am    
Sir, I know that this is a very basic question.., At present I'm totally helpless that I can't share the code with you.. This is a thing that I've done myself in past, but at present, after writing the code, the returning values are of boolean type, and not integer type...
Sinisa Hajnal 12-Jan-16 2:39am    
The fact that you get boolean in return means that you're doing comparisons instead of calculations. If you don't show the code we cannot find the error.

Create button handler and do some calculation. It is extremely simple task. Any tutorial on VB.NET / c# will show you how to do it. If it is the calculation itself that is the problem then the question lacks details that explain it.
Ralf Meier 11-Jan-16 6:32am    
And where do you stuck now ? What is you concret issue ?
Afzaal Ahmad Zeeshan 12-Jan-16 2:42am    
Yes, just in the button's event handler. Write the code to calculate everything.

The boolean and integer are totally irrelevant. An addition or arithmetic would always return an integer (or floating-point value) unless, you operator it like a relational operator.

You can share the code that returns this boolean value and let us check why it does so.

1 solution

It is just what you described: in the button click event handler validate all the inputs (that is the textboxes Text properties) and then perform the calculation.
 
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