Information générale
Catégorie:
Gestionnaire de menu & Menus
Versions des environnements
How to click a button lying on a form thru a short cut menu. On doing so, I face an error "THIS can only be used within a method."
The actual command is 'This.parent.cmdSales.Click'
A menu isn't a child of anything, and what's more, isn't an object, so THIS.Parent is never going to work in a menu procedure.
A menu hit is more like an ON KEY interrupt, you can only address things that are in scope. So you must obtain a reference to your form through some other mechanism. Many people use _screen.ActiveForm or similar, i.e. the command in your menu procedure would be
_screen.ActiveForm.cmdSales.Click()
I'm not saying this would work for you; I'm saying you need to find another way to address your form.
I hope this helps,
- Colin
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement