Programming a generic control handling events
Hi all
On many forms, I dynamicaly create hundreds of textbox. I'd like this textboxes react on events such as press a special key. Every actions perform by each textbox are very similar and very simple: they display a MsgBox with a message given to the textbox on creation time (but messages are different for textbox).
I know how to detect the key press for a static control.
I don't know the good practices in VBA to write the _KeyPress function only once for every controls. Is it possible to create my own control?
Thanks for your help
Florent
Re: Programming a generic control handling events
Am I not clear or there's no answer?
Re: Programming a generic control handling events
If you create the textboxes at runtime then it may be best to create a textbox control array so the event is linked to just one procedure and the passed in Index property will help you identify which textbox it is. Then select case based upon that.
Re: Programming a generic control handling events
Where can I find information about this method? Are the controls created in an array instead of the form? The array will have a _KeyPress with special parameters?
Thanks