Validation Of Controls

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • akshaycjoshi
    New Member
    • Jan 2007
    • 153

    Validation Of Controls

    Ok here is what I have got on my Form.

    One Tab with 3 TabPages.
    Each Tab page cantains some group boxes.
    Each groupBox cantains DatTimePicker,T extBoxes,CheckB oxes etc.

    Some of the controls need to be validated.
    Ex-I want one textbox to have float value only.
    I did that by handling the Validating event and when the error is found, an ErrorProvider is flashed and e.Cancel is set to true to reset the focus on the invalid control.

    When all the controls are properly filled, The user presses the SAVE button.

    (1)The user presses the SAVE button right away without filling the controls.
    I want to check the validation of all the controls at once in the Button's click event, cancelling the save action if not filled properly.
    (2) In above case if the forms is not filled properly, i wanna sfift the focus to that control(change the tabpage as necessary)


    I tried this.ValidateCH ildren() but it returns true even when the textboxes are empty(maybe coz the textboxes are not the immediate children.)
    This is something urgent, so a prompt help would be greatly appreciated.
  • IanWright
    New Member
    • Jan 2008
    • 179

    #2
    Have you done anything with the ValidateChildre n() method?

    If not you can't expect it to magically figure out your validation and do it, you need to implement it.

    Comment

    • akshaycjoshi
      New Member
      • Jan 2007
      • 153

      #3
      Originally posted by IanWright
      Have you done anything with the ValidateChildre n() method?

      If not you can't expect it to magically figure out your validation and do it, you need to implement it.
      How would I do that ?

      Comment

      • IanWright
        New Member
        • Jan 2008
        • 179

        #4
        Events...

        I seriously suggest you discover MSDN. There is a perfect example on there of what you are wanting to do.

        Comment

        Working...