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#
  4. Cancel CellValidating error in DataGridView, so can close form while invalid entry still present

Cancel CellValidating error in DataGridView, so can close form while invalid entry still present

Scheduled Pinned Locked Moved C#
help
4 Posts 2 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.
  • N Offline
    N Offline
    Nigel Mackay
    wrote on last edited by
    #1

    If the user has typed an invalid entry, so that CellValidating raises an error, and they then decide to abandon the edit and want to click the Cancel button, the form won't close because the eror still exists. Error needs to be cleared first. I just can't work out a way to achieve that, short of teaching the user that if they click Cancel, and the form doesn't close, press Esc so text reverts to original and then click Cancel again. Not ideal. :)

    6 1 Reply Last reply
    0
    • N Nigel Mackay

      If the user has typed an invalid entry, so that CellValidating raises an error, and they then decide to abandon the edit and want to click the Cancel button, the form won't close because the eror still exists. Error needs to be cleared first. I just can't work out a way to achieve that, short of teaching the user that if they click Cancel, and the form doesn't close, press Esc so text reverts to original and then click Cancel again. Not ideal. :)

      6 Offline
      6 Offline
      6 921 364 and growing
      wrote on last edited by
      #2

      I know it's pretty old but I faced the same problem and wanted to ask if you managed solve it or not? Even setting CausesValidation property of the close button doesn't work. What have you done to work around the issue? Thanks a lot.

      N 1 Reply Last reply
      0
      • 6 6 921 364 and growing

        I know it's pretty old but I faced the same problem and wanted to ask if you managed solve it or not? Even setting CausesValidation property of the close button doesn't work. What have you done to work around the issue? Thanks a lot.

        N Offline
        N Offline
        Nigel Mackay
        wrote on last edited by
        #3

        As far as I can remember I didn't solve the problem. User must press Esc to cancel the edit before doing ANYTHING else. You notice no-one offered a solution.

        6 1 Reply Last reply
        0
        • N Nigel Mackay

          As far as I can remember I didn't solve the problem. User must press Esc to cancel the edit before doing ANYTHING else. You notice no-one offered a solution.

          6 Offline
          6 Offline
          6 921 364 and growing
          wrote on last edited by
          #4

          Thanks for replying. I saw no one replied but thought you may have devised a work around. The behaviour isn't good. Close button is close button afterall. Anyways thanks for your time. Cheers!

          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