Results 1 to 4 of 4

Thread: Close one form, Show the other! [resolved... blah]

Threaded View

  1. #1

    Thread Starter
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Close one form, Show the other! [resolved... blah]

    I know this has to be the world's easiest VB.NET question!

    Here's what I want: Show form1. Press the button on Form1, and form2 should show up. Form1 should then close.

    Here's what I did

    In a module:
    VB Code:
    1. Module Module1
    2.     Public f1 As New Form1
    3.     Public f2 As New Form2
    4.  
    5.     Sub Main()
    6.         f1.ShowDialog()
    7.     End Sub
    8.  
    9.  
    10. End Module

    In form1's button:

    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         f1.Close()
    3.         f2.Show()
    4.  
    5.  
    6.  
    7.     End Sub

    And that's it!

    Now when I click the button, form2 appears briefly and then disappears.

    Surely it has to be something simple. What am I missing?
    Last edited by mendhak; Jul 13th, 2004 at 04:04 AM.

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