VB Textbox Accept Code
-
:eek:I am trying to find the VB command that invokes after all of the input has been put into a text box, more or less when you tab out or click your mouse into another box. When you double click on the textbox in form design the default is "TextChanged" event. It seems to me that this will run every time the text changes. Lets say I have a 3 digit number. Every time I enter one of the 3 digits the event runs. I don't want the event to run until I am finished all 3 digits. I tried the "OnAcceptsTabChanged" event but that does not seem to be the right one. Can anybody steer me to the right code event? Rich
-
:eek:I am trying to find the VB command that invokes after all of the input has been put into a text box, more or less when you tab out or click your mouse into another box. When you double click on the textbox in form design the default is "TextChanged" event. It seems to me that this will run every time the text changes. Lets say I have a 3 digit number. Every time I enter one of the 3 digits the event runs. I don't want the event to run until I am finished all 3 digits. I tried the "OnAcceptsTabChanged" event but that does not seem to be the right one. Can anybody steer me to the right code event? Rich
You could use the LostFocus event wich occurs as soon as the user selects another component or it looses it's focus for any other reason.
-
:eek:I am trying to find the VB command that invokes after all of the input has been put into a text box, more or less when you tab out or click your mouse into another box. When you double click on the textbox in form design the default is "TextChanged" event. It seems to me that this will run every time the text changes. Lets say I have a 3 digit number. Every time I enter one of the 3 digits the event runs. I don't want the event to run until I am finished all 3 digits. I tried the "OnAcceptsTabChanged" event but that does not seem to be the right one. Can anybody steer me to the right code event? Rich
Look at the
Validating
event. It fires whenever you move the focus between controls which haveCausesValidation = True
. For example, if you have a TextBox, an "OK" button and a "Cancel" button, you would setCausesValidation = True
for the TextBox and "OK" button, andFalse
for the "Cancel" button. Then, when you tab away from the TextBox to the "OK" button, or click the "OK" button, your validation code runs. When you click the "Cancel" button, it doesn't run.