Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculations

Status
Not open for further replies.

beck

Programmer
Mar 22, 1999
26
0
0
US
I have created a software program that does mostly calculations. Once variables are entered the user would click the command button for calculations to be performed and results reviewed. I would like to set it up so that after all the variables are placed by the user the calculation is done automatically without hitting the command button to calculate. Then the user would simply go back and change the variables and the calculations would be done without repeating the hitting of the command button. Any assistance would be appreciated. <p> <br><a href=mailto:accrec@intergrafix.net>accrec@intergrafix.net</a><br><a href= > </a><br>
 
well, I suppose that you could put cmdCalculate_Click in the textbox_validate event of each text box. This way when the user tabs off the text box and your data has been validated the cmdCalculate_click event would be executed.&nbsp;&nbsp;You could also place cmdCalculate_Click in the textbox_Change event although your data validation would be harder as this event is executed each and every time an integer is added to the text box and will run the cmdCalculte_Click event unnecessarily
 
You could also use the textbox_LostFocus event to start your process (validate or calculate) after the user exits the textbox, indicating that the user's entry is complete.
 
All sounds good.. not correcting N E 1 but have a good error routine.. I found its best to use exit sub in the change event to accomplish this<br>
 
Several responses tell you how to do it.&nbsp;&nbsp;You should also consider NOT doing it!.&nbsp;&nbsp;If (as suggested) you create a vilidate program and invoke it from each of the various data point entries, then it will cause the calc to be done every time a user changes any ONE variable.&nbsp;&nbsp;This may (usually) is not the desired result.&nbsp;&nbsp;To figure out when to fire off the validate routine is &quot;Hobson's Choice&quot; (No 'right answer').&nbsp;&nbsp;Better to KISS (Keep It Simple S....).&nbsp;&nbsp;Let the cmdCalc button activate the validation routine.
 
Thank you all for your suggestions. I have tried the above suggestions and found them to work extremely well. I now have another consideration and that is to do nothing and let the user decide when to make the actual calculation. Thank you again for your assistance and now can make the decision either to do it with the above information or just to leave it alone. Thanks again. <p> <br><a href=mailto:accrec@intergrafix.net>accrec@intergrafix.net</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top