Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am using textbox for input and am using regular expressions to test the input.

How do I exit from the expression if I click an exit button to exit the win form.

What I have tried:

I have not tried anything yet because I haven't found a solution by asking the question in forums.
Posted
Updated 23-Mar-20 8:54am
Comments
phil.o 22-Mar-20 18:49pm    
What do you mean by 'exiting a regular expression'?
Dave Kreskowiak 22-Mar-20 18:52pm    
What are you talking about? A RegEx is never "running" beyond the one statement to do a match so there's nothing to exit.

You're going to have to explain this a bit more and show your code to get any kind of an answer on this.

1 solution

I'm guessing somewhat here, but I suspect you're using the Validating[^] event to validate your textbox, and that's preventing you from clicking on your "exit" button unless you've entered a valid value.

If that's the case, you need to set the CausesValidation[^] property on the "exit" button to False. That way, the Validating event will not fire when the button is clicked.
 
Share this answer
 
Comments
Maciej Los 23-Mar-20 15:00pm    
Are you magician?
Richard Deeming 23-Mar-20 15:02pm    
:)
I do sometimes sit down really carefully[^].
Maciej Los 23-Mar-20 16:10pm    
:thumbsup:
bgcwaterman 23-Mar-20 20:23pm    
I am using the Leave event. I see I need to change it to a Validating event..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900