Simple Operations

Last post 02-06-2007 11:20 PM by kjkramer. 5 replies.

Sort Posts:

  • Simple Operations

    02-06-2007, 9:27 PM
    • Loading...
    • kjkramer
    • Joined on 02-06-2007, 9:22 PM
    • Posts 3

    Here is the code I have for one of my forms.

      

            private void button1_click(object sender, EventArgs e)
            {
                
            }
        }
    }

     

     I am trying to have another form open when this button is clicked.  I know you need to add the line inbetween the {}, so dont tell me that.  All I need to know is how to make another form open when this button is pressed.  It would be good also if you could tell me the code to CLOSE the form also.  I'm so new at this, it;s not even funny.  Thanks so much!

    Filed under: , , ,
  • Re: Simple Operations

    02-06-2007, 9:43 PM
    Answer
    • Loading...
    • BMF
    • Joined on 11-02-2006, 2:01 AM
    • CT USA
    • Posts 20

    this should get you started in the right direction:

     

    this.Hide();
    Form2 form2 = new Form2();
    form2.Show();

     

    That will hide the current form, and show the form "Form2"


     

    Nick
    "si vis pacem, para bellum"
  • Re: Simple Operations

    02-06-2007, 9:48 PM
    • Loading...
    • mbanavige
    • Joined on 11-06-2003, 8:29 AM
    • New England, USA
    • Posts 7,705
    • Moderator
      TrustedFriends-MVPs
    BMF:

    this.Hide();
    Form2 form2 = new Form2();
    form2.Show();

    That code is for windows forms and will not work for an asp.net web form.

    Mike Banavige
    ~~~~~~~~~~~~
    Dont forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: Simple Operations

    02-06-2007, 9:49 PM
    • Loading...
    • kjkramer
    • Joined on 02-06-2007, 9:22 PM
    • Posts 3
    yes...i know.  I accidently posted this topic here instead of Vistal Studio 2005, although this worked because i'm using Visual Studio C# 2005.  Thanks!!!
  • Re: Simple Operations

    02-06-2007, 9:55 PM
    • Loading...
    • mbanavige
    • Joined on 11-06-2003, 8:29 AM
    • New England, USA
    • Posts 7,705
    • Moderator
      TrustedFriends-MVPs

    kjkramer:
    yes...i know.  I accidently posted this topic here instead of Vistal Studio 2005, although this worked because i'm using Visual Studio C# 2005.  Thanks!!!

    If you have questions related to window applications then you should be using the MSDN Forums.

    All forums on this site are for web development.

    Mike Banavige
    ~~~~~~~~~~~~
    Dont forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: Simple Operations

    02-06-2007, 11:20 PM
    • Loading...
    • kjkramer
    • Joined on 02-06-2007, 9:22 PM
    • Posts 3
    OK...point taken...thanks again!
Page 1 of 1 (6 items)
Microsoft Communities
Page view counter