Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error that is not an error
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Error that is not an error
Divers
Thread ID:
00416277
Message ID:
00416277
Vues:
46
Error 2012 - Cannot call SetFocus from within a When, Valid, RangeHigh or RangeLow event

How many of us have inadvertently caused this error? Perhaps it was done by calling another form (e.g. lookup form) from the Valid event of a textbox and somewhere along the way, a specific control needs focus so we call Control.SetFocus().

Some of you may have known this (you can get from my tone that I didn't until just now) that this error is slightly misleading. It implies that all SetFocus methods called from Valid events are invalid. This is not the case.

OptionGroups, CommandGroups and Commandbuttons CAN call SetFocus within their Valid events with no errors.

Textboxes, Editboxes, Checkboxes, Listboxes and Spinners can not.

Comboboxes are an entity unto themselves. The Valid event fires twice, once when you select a value and then again when you try to leave the control. A SetFocus can be called from the value selection Valid but VFP throws the error when you try to leave the control.

You can use this information (or not < s >) as you see fit.

Cheers!
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform