Lesson 21 Try It (Handling Errors)
Hello,
For the most part I understand what the code is saying/doing, however I ran into an odd issue with this lessons example and hoping somebody could explain whats wrong and possibly how to fix it.
When I input new item values correctly and calculate, the OK button enables.
I change a value to something that would have an error and press OK.
An error handler processes and a window appears "Price < 0". I press OK.
The new items form closes when it shouldn't and the list adds the item, with the previous correct calculated values.
Notes:
I changed the OK button to NOT be the accept button
this.DialogResult = DialogResult.OK only occurs if ValuesAreOk() returns true
I can even comment out //this.DialogResult = DialogResult.OK, the same results occur.
---This tells me somewhere in the code/compiler it still believes the Ok button is the default Accept Button...
The only way to fix this error I have found was to erase the Ok button code, delete the button, create a new Okay button, paste the code into its click_event handler... Why do I have to completely delete the button to fix this issue? Is there something silly I am missing or not doing? There isn't much code and objects, I've double checked everything and compared it to the downloaded working example (which works)...
Thanks for the help
|