- Moderator
- #1
So, I inherited a Point of Sale system, and the programmer did something that I'm of mixed opinion on. So...
What the programmer was doing was using the labels, gridviews, and so forth as variable storage.
So, instead of saying dSubTotal = 4.00, then setting lblSubTotal.Text = dSubTotal.ToString("F2"), he would instead do...
lblSubTotal.Text = "4.00", and then when he needed to, say, add the subtotal and the tax, he would do a lblTotal.Text = Val(lblSubTotal.Text) + Val(lblTax.Text)
... so he was using the labels as variable storage.
Now, I personally think that this is an incorrect way to do things (and yes, he'd use a gridview to store the individual items, etc. etc. etc...)
My personal opinion is that you keep all those values in a table or variables, and populate the screen from those variables... instead of keeping the values on the screen, then reading the screen back and converting to double, etc. etc.
What is your take on this?
Just my 2¢
"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."
--Greg
What the programmer was doing was using the labels, gridviews, and so forth as variable storage.
So, instead of saying dSubTotal = 4.00, then setting lblSubTotal.Text = dSubTotal.ToString("F2"), he would instead do...
lblSubTotal.Text = "4.00", and then when he needed to, say, add the subtotal and the tax, he would do a lblTotal.Text = Val(lblSubTotal.Text) + Val(lblTax.Text)
... so he was using the labels as variable storage.
Now, I personally think that this is an incorrect way to do things (and yes, he'd use a gridview to store the individual items, etc. etc. etc...)
My personal opinion is that you keep all those values in a table or variables, and populate the screen from those variables... instead of keeping the values on the screen, then reading the screen back and converting to double, etc. etc.
What is your take on this?
Just my 2¢
"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."
--Greg