Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to validate data in property sheet.

How to validate data in property sheet.

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jadhav123
    wrote on last edited by
    #1

    Dear all, I am developing one application containing propertysheet. I want to validate the data that user enters in property pages. The problem I am facing is, when user enters wrong data, I validate this data in property page "OnOK" handler and corresponding message is shown to user. But when user clicks OK button on message box, message box as well as propertysheet get closed. I want this propertysheet remain open so that user can correct the wrong data entered. How to do this? Thanks in advance.

    V R 2 Replies Last reply
    0
    • J jadhav123

      Dear all, I am developing one application containing propertysheet. I want to validate the data that user enters in property pages. The problem I am facing is, when user enters wrong data, I validate this data in property page "OnOK" handler and corresponding message is shown to user. But when user clicks OK button on message box, message box as well as propertysheet get closed. I want this propertysheet remain open so that user can correct the wrong data entered. How to do this? Thanks in advance.

      V Offline
      V Offline
      Viorel
      wrote on last edited by
      #2

      Maybe you should do the validation in OnKillActive handler of property page. According to documentation, "override this member function to perform special data validation tasks". You have to display your error box here and then return FALSE if data are invalid.

      J 1 Reply Last reply
      0
      • J jadhav123

        Dear all, I am developing one application containing propertysheet. I want to validate the data that user enters in property pages. The problem I am facing is, when user enters wrong data, I validate this data in property page "OnOK" handler and corresponding message is shown to user. But when user clicks OK button on message box, message box as well as propertysheet get closed. I want this propertysheet remain open so that user can correct the wrong data entered. How to do this? Thanks in advance.

        R Offline
        R Offline
        Rudolf Jan
        wrote on last edited by
        #3

        If the validation fails, exit the OnOK and do NOT call the OnOK function in the Paerent class. There are better solutions for validation. Each time a field is updated, you should check wheter the information is valid. As long as not all information is valid, you can disable the OK button. Think of handlers like EN_CHANGE (EDIT field) or SELCHANGE (Listbox) etc. I normally add to each dialog a member function to do all validations. It is called each time the user changes anything.

        1 Reply Last reply
        0
        • V Viorel

          Maybe you should do the validation in OnKillActive handler of property page. According to documentation, "override this member function to perform special data validation tasks". You have to display your error box here and then return FALSE if data are invalid.

          J Offline
          J Offline
          jadhav123
          wrote on last edited by
          #4

          thank you very much its working

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups