Hi There,
Could someone please help me with regards to the design of my routine and the use of the validating event.
I have two comboboxes on a form, along with some other text boxes and an OK button and a cancel button.
I have setup the validating event for both comboxes, to verify the contents of them before moving onto the other inputs.
The issue is that the validating event fires when either one of the comboxes loses focus, which is fine, except for when I click the cancel button or the cross on the control box. When I click the cancel button or the cross in the top right of the form to close the form off, I do not want to call the validation events really - which I do not think is posisble.
Thus I thought that I would put some logic in the comboboxes validation events to say if the control receiving the focus is the cancel button or the control box cross, I would not do any validation.
I must admit I do not know how I would do this in VB .NET - I know that there is a controls collection, so maybe I can get the control name that is receiving the focus.
Do you think that this is the way to go, or should I just put all validation into my OK button?
Many thanks for your opinions / help.
Could someone please help me with regards to the design of my routine and the use of the validating event.
I have two comboboxes on a form, along with some other text boxes and an OK button and a cancel button.
I have setup the validating event for both comboxes, to verify the contents of them before moving onto the other inputs.
The issue is that the validating event fires when either one of the comboxes loses focus, which is fine, except for when I click the cancel button or the cross on the control box. When I click the cancel button or the cross in the top right of the form to close the form off, I do not want to call the validation events really - which I do not think is posisble.
Thus I thought that I would put some logic in the comboboxes validation events to say if the control receiving the focus is the cancel button or the control box cross, I would not do any validation.
I must admit I do not know how I would do this in VB .NET - I know that there is a controls collection, so maybe I can get the control name that is receiving the focus.
Do you think that this is the way to go, or should I just put all validation into my OK button?
Many thanks for your opinions / help.