I know there is a CurrForm variable within the system which allows programmers to modify the current form. My question is whether or not there is a similar variable for an element.
I am working on a form which has many, many controls. Each control is filled with information either from a 2-dimensional array of numbers, or from calulations of elements in those arrays. I seek to make all negative numbers formatted red, without having to specificallly reference each array element and control Name.
text box Sales Goal 1 contains ArrayX[1,1]
text box Sales Goal 2 contains ArrayX[1,2]
text box Sales Actual 1 contains ArrayX[2,1]
text box Sales Actual 2 contains ArrayX[2,2]
Instead of creating a line of code for each text box’s OnValidate, like so:
IF ArrayX[1,1] < 0 THEN CurrForm.“Sales Goal 1”.UPDATEFORECOLOR(225);
IF ArrayX[1,2] < 0 THEN CurrForm.“Sales Goal 2”.UPDATEFORECOLOR(225);
IF ArrayX[2,1] < 0 THEN CurrForm.“Sales Actual 1”.UPDATEFORECOLOR(225);
IF ArrayX[2,2] < 0 THEN CurrForm.“Sales Actual 2”.UPDATEFORECOLOR(225);
I would like to create one universal line of code I can paste in every text box OnValidate (98 total). I was hoping there was some kind of code like:
IF CurrControl.Value < 0 THEN CurrForm.CurrControl.UPDATEFORECOLOR(225);
The only problem is that I cannot find out what CurrControl should be, or if such a thing can even be done.
Any help would be much appreciated.