Is there a CurrElement or CurrControl?

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.

Example values:
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.

Well, there are two things:

First, if you are going to use UPDATEFORECOLOR you only could do that in the OnFormat Trigger; thus you have to put some code for each TextBox.

If you want to have a generic function, I would recommend to create two overlaying TextBoxes for the same value, one with forecolor Blak, the other with Red, and use the VISIBLE property to set.

Second: This generic Identifier does not exists. If you are modifying Table Fields, you could evaluate the CurrFieldNo, but I guess this is not feasible for your purpose …

Thank you stryk, that does answer my questions

Knew about the OnFormat trigger, using something similar to the 2 text-boxes and visible property somewhere else, doing that hear would create more work than making custome IF statements for each text box, so I’ll jsut stick with the custom IF statements.

Neither I nor the other programmers here could find a generic control or element identifier, so it’s good to have outside confirmation.

once again, thanks for the info stryk.