Home Forums WinForms controls Other WinForms controls Input Validator + Windows Forms controls cannot cancel

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #18564 |

    Hi,

     I have a form with 1 button, 1 textbox and 1 validator.

    The validator validates the content of the textbox for compulsary data entry.  The button will cancel any changes made to the textbox and stops the validator continuing monitoring the content of the textbox.

    When I type data into the textbox, it satisfied the validation rule.  There will be no exclaimation mark next to the textbox.  This is okay.

    When I delete any content within the textbox field or simply let the textbox got focus then tries to cancel the editing by clicking on the button.  It will, however, still attempt to validate the control thinking that its not validated.

    I have a validating event setup to monitor any validation errors.  Within the routine, I set the e.cancel = false as suggested in another thread.  This didn’t work. 

    Initially, when I click on the button, I tried to make the button_click routine to set the validationerror to string.empty.  This does get rid of the exclaimation mark, but it still won’t allow me to lose focus and move into another control for some strange reason. 

    Any ideas?!

    Imported from legacy forums. Posted by James (had 3450 views)

    Xceed Support
    Member
    Post count: 5658

    Hi James,

    Could you provide a code snippet of your implementation to check what could be the issue? Thank you.

     

    Imported from legacy forums. Posted by Mohamed [Xceed] (had 298 views)

    User (Old forums)
    Member
    Post count: 23064

    Mohamed,

    I have attached a copy of the sample code as requested.  (Sent via email to technical support support@xceedsoft.com)

    I have made a slight modification to the program, it’s not the button that is playing up… As I cannot click on the winbutton unless the validation process succeeded.  I do not know if there is a way out for this or not. 

    Anyway, I have implemented a toolstrip so that I could try to bypass the validation process and proceed with the click event of the toolstrip.

    Now, the entire scenario goes like this…

    I am trying to setup a inventory system where new items can be added.  However, there may be certain information that are compulsary (e.g. ID of a product should not duplicate, but this is not used as the primary key). 

    Everything will work just fine when the user does proceed with data entry etc etc.

    However, when the user accidently clicked the add new button, he could not cancel the action unless all compulsary fields have been filled in accordingly (regardless of the correctness of the data entered).  At this point in time, the user is stuck.

    I have tried to clear the validationerror as soon as the click event of the toolstrip is executed.  But, it still proceed to the validating event of the textbox currently having focus.  I tried to add e.cancel = false as suggested in the forum, but it still won’t work in any way. 

    Any help would be appreciated.

    Best regards,

    James CHANG

    Imported from legacy forums. Posted by James (had 1577 views)

    User (Old forums)
    Member
    Post count: 23064

    How do I email the code to you?!?!

    Imported from legacy forums. Posted by James (had 4361 views)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.