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 to hide form when another form opens?

How to hide form when another form opens?

Scheduled Pinned Locked Moved C#
helptutorialquestion
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.
  • H Offline
    H Offline
    haroon1980
    wrote on last edited by
    #1

    I have a form where there is a button and i want to launch an another form by the help of that button which is done but when second form opens it doesnt close the first one as i did many tries. Following is my code snippet private void LoadGameButton_Click(object sender, EventArgs e) { TicTacToe tic=new TicTacToe(); tic.Show(); log = new Login(); log.Close(); // or i tried hide and different ways here but still login form appear } Please help

    M 1 Reply Last reply
    0
    • H haroon1980

      I have a form where there is a button and i want to launch an another form by the help of that button which is done but when second form opens it doesnt close the first one as i did many tries. Following is my code snippet private void LoadGameButton_Click(object sender, EventArgs e) { TicTacToe tic=new TicTacToe(); tic.Show(); log = new Login(); log.Close(); // or i tried hide and different ways here but still login form appear } Please help

      M Offline
      M Offline
      Martin 0
      wrote on last edited by
      #2

      Hello,

      shah123 wrote:

      log = new Login(); log.Close(); // or i tried hide and different ways here but still login form appear

      this creates a new instance of o Form and closes it directly after creaton. Just add: this.Hide(); All the best, Martin

      H 1 Reply Last reply
      0
      • M Martin 0

        Hello,

        shah123 wrote:

        log = new Login(); log.Close(); // or i tried hide and different ways here but still login form appear

        this creates a new instance of o Form and closes it directly after creaton. Just add: this.Hide(); All the best, Martin

        H Offline
        H Offline
        haroon1980
        wrote on last edited by
        #3

        Thanks a million. It worked.

        M 1 Reply Last reply
        0
        • H haroon1980

          Thanks a million. It worked.

          M Offline
          M Offline
          Martin 0
          wrote on last edited by
          #4

          You are wellcome! I'm glad I could help!

          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