rgn2121
asked on
Windows Forms Control Validation and allowing form close.
I am using code in my Validating event on a ComboBox to force the user to make a choice, which works, but once the user opens the form then they have to make a choice before they can close it. I was to check if the form is closing, then skip validation... I use the code below to validate...
If String.IsNullOrEmpty(ComboBox1.SelectedItem) Then
e.Cancel = True
End If
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You know...I am not sure that solution really works, because if they don't make a selection and they click another control on the form, then it will allow it because I allow ComboBox.SelectedItem=Noth ing.
Is there a way to tell if the form is closing without using API?
Is there a way to tell if the form is closing without using API?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER