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. How can I close one form

How can I close one form

Scheduled Pinned Locked Moved C#
question
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.
  • M Offline
    M Offline
    mariuszfryta
    wrote on last edited by
    #1

    In my application I have one main window adn the second appears when I want to type in some data, then I click on the my bytton and I want to close that form. How can I do it?. I have tried the Application.Exit(); command but it close all windows. Mariuszfryta

    S S 2 Replies Last reply
    0
    • M mariuszfryta

      In my application I have one main window adn the second appears when I want to type in some data, then I click on the my bytton and I want to close that form. How can I do it?. I have tried the Application.Exit(); command but it close all windows. Mariuszfryta

      S Offline
      S Offline
      Sean89
      wrote on last edited by
      #2

      this.Close();


      M 1 Reply Last reply
      0
      • M mariuszfryta

        In my application I have one main window adn the second appears when I want to type in some data, then I click on the my bytton and I want to close that form. How can I do it?. I have tried the Application.Exit(); command but it close all windows. Mariuszfryta

        S Offline
        S Offline
        Stefan Troschuetz
        wrote on last edited by
        #3

        Instead of Application.Exit call the Close method of your Form inside the click event handler of your button. Another way would be setting the DialogResult property of your button to something else than None. This way you don't even need the click event handler.


        "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

        www.troschuetz.de

        1 Reply Last reply
        0
        • S Sean89

          this.Close();


          M Offline
          M Offline
          mariuszfryta
          wrote on last edited by
          #4

          Thanks.

          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