Re: Best Practices Issue
- Posted by "C. K. Lester" <cklester at yahoo.com> Feb 07, 2003
- 445 views
> I will typically use the value directly from the control if I only need > to reference the value 1 or 2 times top. > > If I need to reference the value in another routine (maybe with a global > variable) or need to reference the value more than 2 times within a > function I'll assign to a variable. This reduces clutter, makes the > code easier to read and also allows me to ? the value of the variable in > debug. It also helps with performance as you're not having to call > getText() multiple times. Hey, Jonas, thanks for the response. Here's a follow-up for you (and anybody else who wants to chime in): what do you do if a value changes in your variable, but not as a result of the control itself? For example, let's say we have txt_Total (a text box that is uneditable by the user and whose value is equal to the sum of four other text boxes). Let's say you've decided to use variables to track your control values (or rather, control values are determined by certain variables). When do you check for and update the control value? Basically, how do you update control values based on variables that have no onChange() event?