Validating Data?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike

    #1

    Validating Data?

    Hi,

    In one of my winforms I am validating a textbox making sure it was filled
    out and that the data is numeric and setting e.Cancel = true if not.
    Everything works fine however the form has a OK and Cancel button. I do not
    want the user be able to submit the form if the data is not correct (which
    works fine by setting e.Cancel = true) however I want to the user to be able
    to hit cancel and which closes the form. Right now by setting e.Cancel =
    true does not allow me to close the form. But if do not use e.Cancel = true
    then the user will be able to submit wrong data. Is there a way to get
    around this?

    Thanks


  • Mike

    #2
    Re: Validating Data?

    Nevermind I figured it out. All you need to do is test to see if the Cancel
    Button has focus in the validating event of each control.

    "Mike" <spam@hotmail.c om> wrote in message
    news:eX$ccfioDH A.2268@TK2MSFTN GP12.phx.gbl...[color=blue]
    > Hi,
    >
    > In one of my winforms I am validating a textbox making sure it was filled
    > out and that the data is numeric and setting e.Cancel = true if not.
    > Everything works fine however the form has a OK and Cancel button. I do[/color]
    not[color=blue]
    > want the user be able to submit the form if the data is not correct (which
    > works fine by setting e.Cancel = true) however I want to the user to be[/color]
    able[color=blue]
    > to hit cancel and which closes the form. Right now by setting e.Cancel =
    > true does not allow me to close the form. But if do not use e.Cancel =[/color]
    true[color=blue]
    > then the user will be able to submit wrong data. Is there a way to get
    > around this?
    >
    > Thanks
    >
    >[/color]


    Comment

    Working...