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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Will this code work right in the long term???

Status
Not open for further replies.

rtshort

IS-IT--Management
Feb 28, 2001
878
US
I have a MSHFlexGrid using it as an autorepair invoice. It contains columns for (LaborHours, Materials, & PartsPrice).
It has a TextBox(for Totals) for all of the columns mentioned above plus one for SalesTax and GrandTotal. I have been suscessful in writing a public sub to total up each item for each TextBox. (If I tried it as a PrivateSub, it would not work??) Each time an item is added I have to call all of the subs to get each total. (e.g. 1) Call LaborTotal 2) Call MaterialsTotal 3) Call PartsPriceTotal 4) Call SubTotal 5) Call GrandTotal)

My question is, am I calling too many subs or is it OK to call all of the subs as long as they are in the proper order? I have tried it and it works with all of the numbers I've thrown at it so far, I just don't want problems down the road. Every day above ground is a GOOD DAY!!!
 
If working with grid, I don't see another way to get total of items.
 
It'll work good until your database gets real big. You'll want to export this data to a file at the end of the month so you don't fill up a grid that much. I've put up to about 1000 items like this and you'll have to wait about 1 to 2 sec between entries using a PII-400. I'd put off adjusting all the columns until the user hits "recalculate", or recalculate when the user exits (note, you don't want to put too much in the form.terminate or form.unload events because VB has a nasty habit of dumping the code execution before its done with the calculations. Alternately there are some grid controls out there that are substantially faster and have some excel-like features built in. Check out a VB Programmers Journal for the ads.
 
Thanks for the input guys. Every day above ground is a GOOD DAY!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top