Welcome to the Xceed Community | Help
Community Search  
More Search Options

Input Validator + Windows Forms controls cannot cancel

Sort Posts: Previous Next
  •  05-25-2009, 8:10 AM Post no. 21162

    Input Validator + Windows Forms controls cannot cancel

    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?!

  •  05-25-2009, 11:18 AM Post no. 21170 in reply to 21162

    Re: Input Validator + Windows Forms controls cannot cancel

    Hi James,

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

     


    Xceed - Software Developer and Technical Support
  •  05-25-2009, 10:16 PM Post no. 21186 in reply to 21170

    Re: Input Validator + Windows Forms controls cannot cancel

    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

  •  05-26-2009, 12:29 PM Post no. 21202 in reply to 21170

    Re: Input Validator + Windows Forms controls cannot cancel

    How do I email the code to you?!?!
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.