I have been trying to work through some basic error checking in my form and I cannot seem to have the PS script return to the form when the error condition is true. Here is my use case:
I have a list box that I want to ensure that at least one item is selected when the Run button is clicked. If there is not an item selected, I want the background of the list box to turn red and the user to have to select something before it turns normal and the user can proceed. The other way that I have been trying to do is have the Run button disabled until something is selected in the list box. (I actually have two list boxes that I need to have populated before allowing the script to run)
This has been great fun learning this so far, however I am stumped at this point.
Cheers
Dave
Retrun to Form
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Retrun to Form
Look into Windows Forms validation. There are controls to handle error reporting and events that occur as the control is validated and as the form is validated.
This is a big topic so there is not simple one size fits all. Simply validate in the validating event. Return true/false to allow continuation and use "validated" to enable next or other controls due to a successful validation.
Here are some starter articles on forms validation:
http://www.sapien.com/blog/?s=validation
This is a big topic so there is not simple one size fits all. Simply validate in the validating event. Return true/false to allow continuation and use "validated" to enable next or other controls due to a successful validation.
Here are some starter articles on forms validation:
http://www.sapien.com/blog/?s=validation