Results 1 to 4 of 4

Thread: form hide

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    form hide

    hi

    this is sooo frustrating

    i have 2 forms

    i hide form 1, and form 2 is shown

    when i click a button on form 2, i want that form 2 to hide and form 1 to be shown again

    how?

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    pass a reference of each form to the other form when they are created, then acccess its methods.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773
    ??

  4. #4
    Hyperactive Member fret's Avatar
    Join Date
    Sep 2004
    Posts
    472
    dunno if this help.
    in the frm1:
    VB Code:
    1. void Button1_Click(object sender,EventArgs e)
    2.     {
    3.         Form f=new frm2(this);
    4.         this.Hide();
    5.         f.Show();
    6.     }
    in the frm2:
    VB Code:
    1. public frm2(Form f)
    2.     {
    3.         this.f=f;
    4.         }
    5.  
    6. Form f;
    7.     void Button2_Click(object sender,EventArgs e)
    8.     {
    9.         f.Show();
    10.         this.Hide();
    11.     }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width