Opening/Closing(Hiding) Forms

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Guest

    #1

    Opening/Closing(Hiding) Forms

    Hi,
    I am writing a Jeopardy-like game that contains three
    forms. One is the Jeopardy board, another is the
    Question/Answer displayer, and the last is the
    scoreboard. I need to find a way to open the scoreboard
    as hidden when the program starts. This is because the
    scoreboard must constantly keep score, even when it is
    not in use. I cannot seem to cause my program to access
    the scoreboard from my question/answer displayer, which
    is supposed to open it. I also do not know how to hide
    or close the forms when I am not using them. I am
    relatively new, so I do not have much expertise in these
    simple areas.

    -Thanks
  • Nick Malik

    #2
    Re: Opening/Closing(Hiding) Forms

    Hello

    May I suggest that you do something a little different. Consider putting
    all of the information on a single form. Ask the questions in one part of
    the form, keep score in another. If you are as new as you appear to be, you
    will be better off avoiding the complexity.

    Now, to answer your original question:

    if your score form is called "ScoreForm" then simply code:
    ScoreForm.Hide;
    in your main form code (assuming you created the ScoreForm from the main
    form).


    Good luck.
    --- Nick

    "Guest" <anonymous@disc ussions.microso ft.com> wrote in message
    news:086e01c3c0 5f$9b041cf0$a10 1280a@phx.gbl.. .[color=blue]
    > Hi,
    > I am writing a Jeopardy-like game that contains three
    > forms. One is the Jeopardy board, another is the
    > Question/Answer displayer, and the last is the
    > scoreboard. I need to find a way to open the scoreboard
    > as hidden when the program starts. This is because the
    > scoreboard must constantly keep score, even when it is
    > not in use. I cannot seem to cause my program to access
    > the scoreboard from my question/answer displayer, which
    > is supposed to open it. I also do not know how to hide
    > or close the forms when I am not using them. I am
    > relatively new, so I do not have much expertise in these
    > simple areas.
    >
    > -Thanks[/color]


    Comment

    • Morten Wennevik

      #3
      Re: Opening/Closing(Hiding) Forms

      You show or hide a form by calling it's Show() and Hide() and close it
      with Close();

      Another way to show scoreboard only when needed is to keep track of the
      score in your question/answer class. When you need to show the score you
      create a new scoreboard and pass the current score as a parameter. Then
      use Show/ShowDialog on it.

      public class Parent
      {
      int score;

      private void ShowScore()
      {
      ScoreBoard sb = new ScoreBoard(scor e);
      sb.ShowDialog() ; // score.Show(); will open the scoreboard as modeless
      instead
      }
      }

      Or you could create it once and save the reference to sb, and then call
      sb.Show()/sb.Hide() when you need it.
      --
      Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

      Comment

      Working...