My code uses AddEvent(ctls(i),"GotFocus","Highlight") in App_start to highlight active textbox and similar sub for LostFocus event to make inactive textboxes' BG white.
Now if I add validation sub in LostFocus event of a particular textbox, it does not fire.
(adding or leaving quotes is not making difference in AddEvent, at least in my code.)
My code uses AddEvent(ctls(i),"GotFocus","Highlight") in App_start to highlight active textbox and similar sub for LostFocus event to make inactive textboxes' BG white.
Wires a control event to a specific sub.
Syntax: AddEvent (Control Name, Event Name, Sub Name)
...
Note: As in this example, Event Name is not quoted and can't be a variable.
Example:
AddEvent ("Button1", Click, "MySub")
Firstly it is not obvious that you need to call AddEvent() at all, if your text box is defined on the form via the Designer you can add the GotFocus and LostFocus events that way too.
So the Help says that the event name should not be quoted, the 1st parameter is the name of a control (what is your "ctls(i)"?) and the 3rd/last parameter is the name of a Sub that you have included in your program (what is "Highlight" and what does it do?).
Perhaps it would be easier if you attached your complete source code, so we can see what objects you are referring to, and which item in your form will initially have the focus.