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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Multiple Form problems

Multiple Form problems

Scheduled Pinned Locked Moved Visual Basic
csharpgame-devhelptutorial
10 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
    Achithyn
    wrote on last edited by
    #1

    Hello everyone, I am really new with Visual Basic .NET 2003 and have come across a problem that I cannot seem to figure out. I have spent a lot of time reading in books and articles to figure this out, and because it is such a simple problem - it is quite frustrating. I am making a Tic Tac Toe game to get more familiar with VB. I have already finished a very simple Tic Tac Toe program and now am moving into an advanced version with multiple forms. Each form acts like the next screen within the game - so, I wanted to make it so that the forms would hide and show themselves in the same area as the last screen. Also, at the bottom of the screen - the task bar resets every time a form is loaded. Any information on how to manage multiple forms to act as if they are only one form would be great. Articles, Links, Examples, anything you can spare. My current way for showing and hiding a form is: dim testform as new testform testfor.show() I am using key words Show, Close, and Hide. Well, anything would be helpful. Thanks! ~Achithyn

    N D 2 Replies Last reply
    0
    • A Achithyn

      Hello everyone, I am really new with Visual Basic .NET 2003 and have come across a problem that I cannot seem to figure out. I have spent a lot of time reading in books and articles to figure this out, and because it is such a simple problem - it is quite frustrating. I am making a Tic Tac Toe game to get more familiar with VB. I have already finished a very simple Tic Tac Toe program and now am moving into an advanced version with multiple forms. Each form acts like the next screen within the game - so, I wanted to make it so that the forms would hide and show themselves in the same area as the last screen. Also, at the bottom of the screen - the task bar resets every time a form is loaded. Any information on how to manage multiple forms to act as if they are only one form would be great. Articles, Links, Examples, anything you can spare. My current way for showing and hiding a form is: dim testform as new testform testfor.show() I am using key words Show, Close, and Hide. Well, anything would be helpful. Thanks! ~Achithyn

      N Offline
      N Offline
      Nick Seng
      wrote on last edited by
      #2

      A suggestion. How about using an MDI application, and letting your forms be a children within the parent?


      "if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.

      A 1 Reply Last reply
      0
      • N Nick Seng

        A suggestion. How about using an MDI application, and letting your forms be a children within the parent?


        "if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.

        A Offline
        A Offline
        Achithyn
        wrote on last edited by
        #3

        I will look into MDI forms and see what happens :o) Thank you for the prompt reply! If there is anything else that may be able to help me make this little program of mine, feel free to share. Thanks again - I will see what happens and, depending, post back here. ~Achithyn

        N 1 Reply Last reply
        0
        • A Achithyn

          I will look into MDI forms and see what happens :o) Thank you for the prompt reply! If there is anything else that may be able to help me make this little program of mine, feel free to share. Thanks again - I will see what happens and, depending, post back here. ~Achithyn

          N Offline
          N Offline
          Nick Seng
          wrote on last edited by
          #4

          No Prob. I too, once tried to make a tic tac toe program. It wasn't too good, but it was fun. Good luck with your app. :)


          "if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.

          A 1 Reply Last reply
          0
          • N Nick Seng

            No Prob. I too, once tried to make a tic tac toe program. It wasn't too good, but it was fun. Good luck with your app. :)


            "if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.

            A Offline
            A Offline
            Achithyn
            wrote on last edited by
            #5

            I have been doing whatever I can to learn what I can do to fix this small problem. I happen to be quite the perfectionist. :( I think that can be both a good thing and bad thing. Well, I looked more into what MDI is and what it is used for and this is what I got: Quote from MSDN ----Multiple-document interface (MDI) applications allow you to display multiple documents at the same time, with each document displayed in its own window. MDI applications often have a Window menu item with submenus for switching between windows or documents. Also, when you change the form you wish to be the MDI Parent, it changes the color to a gray. I found another snippet from MSDN that said: Quote from MSDN ----Additionally, be aware that the edge of the MDI parent form will pick up the system color (set in the Windows System control panel), rather than the back color you set using the Control.BackColor property. I do not understand where I can edit the Windows System Control Panel. Another thing with MDI is said it is best to use with a maximized screen rather than a small version of the screen. I was told that I may want to check in with Modal and see if that would help, though I do not know what that is. Once again, anything would help - thanks for the time! ~Achithyn

            N 1 Reply Last reply
            0
            • A Achithyn

              I have been doing whatever I can to learn what I can do to fix this small problem. I happen to be quite the perfectionist. :( I think that can be both a good thing and bad thing. Well, I looked more into what MDI is and what it is used for and this is what I got: Quote from MSDN ----Multiple-document interface (MDI) applications allow you to display multiple documents at the same time, with each document displayed in its own window. MDI applications often have a Window menu item with submenus for switching between windows or documents. Also, when you change the form you wish to be the MDI Parent, it changes the color to a gray. I found another snippet from MSDN that said: Quote from MSDN ----Additionally, be aware that the edge of the MDI parent form will pick up the system color (set in the Windows System control panel), rather than the back color you set using the Control.BackColor property. I do not understand where I can edit the Windows System Control Panel. Another thing with MDI is said it is best to use with a maximized screen rather than a small version of the screen. I was told that I may want to check in with Modal and see if that would help, though I do not know what that is. Once again, anything would help - thanks for the time! ~Achithyn

              N Offline
              N Offline
              Nick Seng
              wrote on last edited by
              #6

              Hmmm...let's see how to explain MDI Applications. Take for example MS Word. Word can have several documents open inside one parent. When you close all the word document, what you see is basically a word with only toolbars and a gray background. That's how a parent form looks like without a child. And all the documents in words are the child forms. you can resize, minimize, maximize, etc. I'm probably not explaining it too well. :doh:


              "if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.

              1 Reply Last reply
              0
              • A Achithyn

                Hello everyone, I am really new with Visual Basic .NET 2003 and have come across a problem that I cannot seem to figure out. I have spent a lot of time reading in books and articles to figure this out, and because it is such a simple problem - it is quite frustrating. I am making a Tic Tac Toe game to get more familiar with VB. I have already finished a very simple Tic Tac Toe program and now am moving into an advanced version with multiple forms. Each form acts like the next screen within the game - so, I wanted to make it so that the forms would hide and show themselves in the same area as the last screen. Also, at the bottom of the screen - the task bar resets every time a form is loaded. Any information on how to manage multiple forms to act as if they are only one form would be great. Articles, Links, Examples, anything you can spare. My current way for showing and hiding a form is: dim testform as new testform testfor.show() I am using key words Show, Close, and Hide. Well, anything would be helpful. Thanks! ~Achithyn

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                The problem doesn't lend itself to being a multiple app form. Are you saying that your closing each form after a move is made and showing the next form to display the results and waiting for the next move? Walking from form to form in a game is not a good idea because each copy of the form will hold a reference to the next form, thereby keeping ALL of them open and running. When the last form is done, each form leading up to that one must close in the reverse order that they were launched in order to properly release its resources. All your oding with this method is taking up more and more memory the farther into the game to get. You can't close your first form, you can hide it though, because the is the form that has your main message pump behind it. Once that pump is ended, your entire app closes, not just that form. A better multiple app version of the game would be to display the board in one window and the game status and, possibly, the computers thinking in another form. This way you only have 2 forms to manage and it better represents a real world application. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                A 1 Reply Last reply
                0
                • D Dave Kreskowiak

                  The problem doesn't lend itself to being a multiple app form. Are you saying that your closing each form after a move is made and showing the next form to display the results and waiting for the next move? Walking from form to form in a game is not a good idea because each copy of the form will hold a reference to the next form, thereby keeping ALL of them open and running. When the last form is done, each form leading up to that one must close in the reverse order that they were launched in order to properly release its resources. All your oding with this method is taking up more and more memory the farther into the game to get. You can't close your first form, you can hide it though, because the is the form that has your main message pump behind it. Once that pump is ended, your entire app closes, not just that form. A better multiple app version of the game would be to display the board in one window and the game status and, possibly, the computers thinking in another form. This way you only have 2 forms to manage and it better represents a real world application. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                  A Offline
                  A Offline
                  Achithyn
                  wrote on last edited by
                  #8

                  The reason I have several forms, is to collect information from the player and pass it on to the next form. The actual game play is all done within one form. This is how it is built for Player Vs. Player: --Form1 (frmMenu) is the first Game Menu that loads when you start the game. --Form2 (frmSettings) is the form that loads when you click on "Vs. Player" button. This form allows the member to choose their name, mark type (you can change the normal "X" to a 3 character mark, such as initials) and color. --Form3 (frmGame) is the actual game that loads when you continue from Form2. This Form holds all the information for the game and allows you to play. This form will be changed depending upon settings you set in Form2 - or if you play Vs. Computer - or take the adventure mode. You see, the actual game is not laid out to work in several forms, the multiple forms are simply there to retrieve data for the actual game. I have been thinking more and more on MDI - and now I think I know how it works and how it will work on this game. The main screen will be the parent, and then frmMenu, frmSettings, frmGame and any other form that I make later on will be the child form to this parent so that all will be organized and within the parent. I know why the backcolor changes to gray now, and know how to go around that problem. I will not close the forms that load, rather use the Hide() command instead. As for the main form, you can close it if you want by using dim frmMenu as new frmMenu and Show() within the form load code bit. I don't know how bad or good that is with the program, just know that it works... lol. Well, thanks for the help guys, I will see what happens. :) ~Achithyn

                  D 1 Reply Last reply
                  0
                  • A Achithyn

                    The reason I have several forms, is to collect information from the player and pass it on to the next form. The actual game play is all done within one form. This is how it is built for Player Vs. Player: --Form1 (frmMenu) is the first Game Menu that loads when you start the game. --Form2 (frmSettings) is the form that loads when you click on "Vs. Player" button. This form allows the member to choose their name, mark type (you can change the normal "X" to a 3 character mark, such as initials) and color. --Form3 (frmGame) is the actual game that loads when you continue from Form2. This Form holds all the information for the game and allows you to play. This form will be changed depending upon settings you set in Form2 - or if you play Vs. Computer - or take the adventure mode. You see, the actual game is not laid out to work in several forms, the multiple forms are simply there to retrieve data for the actual game. I have been thinking more and more on MDI - and now I think I know how it works and how it will work on this game. The main screen will be the parent, and then frmMenu, frmSettings, frmGame and any other form that I make later on will be the child form to this parent so that all will be organized and within the parent. I know why the backcolor changes to gray now, and know how to go around that problem. I will not close the forms that load, rather use the Hide() command instead. As for the main form, you can close it if you want by using dim frmMenu as new frmMenu and Show() within the form load code bit. I don't know how bad or good that is with the program, just know that it works... lol. Well, thanks for the help guys, I will see what happens. :) ~Achithyn

                    D Offline
                    D Offline
                    Dave Kreskowiak
                    wrote on last edited by
                    #9

                    Sorry. Your first post made it sound like you were launching a new form with each step in the game, not an options form. You can't close the main form that was launched when your app started. You can HIDE it, but closing it will result in your app closing. You might want to check this[^] out to clear up any grey areas concerning multiple forms and passing data. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                    A 1 Reply Last reply
                    0
                    • D Dave Kreskowiak

                      Sorry. Your first post made it sound like you were launching a new form with each step in the game, not an options form. You can't close the main form that was launched when your app started. You can HIDE it, but closing it will result in your app closing. You might want to check this[^] out to clear up any grey areas concerning multiple forms and passing data. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                      A Offline
                      A Offline
                      Achithyn
                      wrote on last edited by
                      #10

                      Awesome, thank you for the information. I will check out the MSDN chapter to this and see what else I learn. :) ~Achithyn

                      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