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. Problems closing forms

Problems closing forms

Scheduled Pinned Locked Moved C#
csharphelpvisual-studio
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.
  • B Offline
    B Offline
    bootn
    wrote on last edited by
    #1

    HI all, I am pretty new to the whole C# and Visual Studio scene and I am having a problem with closing my forms. I have a main form open, then after clicking a button (ie search) I pop-up another window. When I have finished with the window the user must close it, but everytime you click it it will close both the window and the main form instead of just the window. I have tried: - this.Close(); - this.Close(frmSearch); - Form.ActiveForm.Close(); But to no avail. Any help would be great! Cheers Guys Carnal (Car-Lan) Car and Computer Club http://carnalonline.org.

    S 1 Reply Last reply
    0
    • B bootn

      HI all, I am pretty new to the whole C# and Visual Studio scene and I am having a problem with closing my forms. I have a main form open, then after clicking a button (ie search) I pop-up another window. When I have finished with the window the user must close it, but everytime you click it it will close both the window and the main form instead of just the window. I have tried: - this.Close(); - this.Close(frmSearch); - Form.ActiveForm.Close(); But to no avail. Any help would be great! Cheers Guys Carnal (Car-Lan) Car and Computer Club http://carnalonline.org.

      S Offline
      S Offline
      seee sharp
      wrote on last edited by
      #2

      I preassume that you create instance of form when you click button(search). FormSearch search = new FormSearch(); search.show(); to close this you can use search.Close(); This will close only search form. And if the close button is on search form itself, you should be able to use this.Close(); :):) - ashish

      B 1 Reply Last reply
      0
      • S seee sharp

        I preassume that you create instance of form when you click button(search). FormSearch search = new FormSearch(); search.show(); to close this you can use search.Close(); This will close only search form. And if the close button is on search form itself, you should be able to use this.Close(); :):) - ashish

        B Offline
        B Offline
        bootn
        wrote on last edited by
        #3

        Thanks for the reply but that doesnt seem to work. It closes the form but still closes the whole system.... I am totally out of ideas! If anyone can help that would be great!

        G 1 Reply Last reply
        0
        • B bootn

          Thanks for the reply but that doesnt seem to work. It closes the form but still closes the whole system.... I am totally out of ideas! If anyone can help that would be great!

          G Offline
          G Offline
          grim_zax
          wrote on last edited by
          #4

          try looking at the close() events... maybe there is a close there somewhere ... and also try looking for Application.Exit method ... maybe you place something like this in your app its me =Þ grim zax

          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