Validating text box when OK button is pressed
Hey All
I'm just starting to look at textBox validation by creating an InputBox form which the user can enter a string into a text box and then click either OK or Cancel (which have the DialogueResult set to = OK and Cancel). There is an event that occurs when the textBox is validating in which I check if the textBox contains a string or not. Currently when I click either the OK or Cancel buttons the check is performed, however I want to only perform it when the OK button is clicked. Is there anyway of determine what caused the validating event? Or any ideas how I can only perform the check when the OK button is clicked?
I could have an event occur when the button is pressed that checks the textBox, but thought I would give the textBox validating method a go. Any ideas would be greatly appreciated!
Cameron
CameronPosted Aug 5, 2009, 1:40 AM
Danatas GerviPosted Aug 2, 2009, 4:09 AM
2. Move the checking of data from Validated event - to Ok click event handler. Leave the Cancel click unhanled.
Problem is : the "text box validated" raises when the textbox lost focus. In this time it is unknown, wich control will get focus - button Ok, button Cancel or other text box...