I think the answers given miss the original question.
There are 20 textboxes, txt01, txt02, ... txt20. Assume each has the value of 1. Therefore
- txtAvg = (txt01 + txt02 + ... + txt20) / 20
will assign a "1" into txtAvg. If txt14 is changed to 21, then txtAvg needs to be "2" as soon as txt14 is changed. Now if the user changes txt08 to 41, txtAvg needs to change to "4".
So the question is: "Where is the above line of code best put so that whenever any of the textboxes txt01, txt02, ... is changed, txtAvg shows the correct value?"
The form's On Dirty Event only fires once, after the first change. It does not fire on subsequent changes. There is no On Dirtier Event.
I would probably put the above logic in a function, and then for the On Change or After Update event for each of the 20 textboxes call the function.
The function could be called from the form's On Key Press function and be more dynamic, but this requires knowing which control has the focus (is being changed), and using .Text or .Value as necessary. This can get messy if the user makes a typo.