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. AcceptButton & Show()

AcceptButton & Show()

Scheduled Pinned Locked Moved C#
helpquestion
3 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.
  • A Offline
    A Offline
    Arun Bhalla
    wrote on last edited by
    #1

    Is it a bug of a feature that AcceptButton only seems to work with Form.ShowDialog() and not with Form.Show()? That is, when a form is displayed with Show(), the Enter key is ignored, but with ShowDialog(), the Enter key causes the form to be accepted (OK). Arun

    M U 2 Replies Last reply
    0
    • A Arun Bhalla

      Is it a bug of a feature that AcceptButton only seems to work with Form.ShowDialog() and not with Form.Show()? That is, when a form is displayed with Show(), the Enter key is ignored, but with ShowDialog(), the Enter key causes the form to be accepted (OK). Arun

      M Offline
      M Offline
      Mike Ellison
      wrote on last edited by
      #2

      Hmm... would that be because the modal nature of a dialog box? It seems logical to me that a modal dialog could be dismissed with an accept button, but not necessarily a modeless form.

      1 Reply Last reply
      0
      • A Arun Bhalla

        Is it a bug of a feature that AcceptButton only seems to work with Form.ShowDialog() and not with Form.Show()? That is, when a form is displayed with Show(), the Enter key is ignored, but with ShowDialog(), the Enter key causes the form to be accepted (OK). Arun

        U Offline
        U Offline
        User 260964
        wrote on last edited by
        #3

        I think that it has to do with the ShowDialog[^] form being modal, and that Show[^] is inherited from Control[^], which only makes the Form visible. When it's modal, it's usually a form in which the user has to give some input, and press Enter to accept (or Esc to cancel). - Daniël Pelsmaeker

        There are 10 kinds of people in the world. Those that understand binary and those that do not.

        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